linux脚本定期执行
vi /etc/crontab
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR #sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * command to be executed # ## 30 01 * * * root sh /home/tsecuser/syncHQdata/DataSync.sh 30 07 * * * root sh /home/tsecuser/TextData/startsql.sh 30 04 * * * root sh /home/tsecuser/syncHQdata_ALL/DataSync.sh 30 15 * * * root sh /home/pas/copy.sh
copy.sh
#!/bin/sh rm -rf /home/pas/upload/* cp -r /usr/local/tomcat2/webapps/upload/* /home/pas/upload/
更新另一个服务器
#!/bin/sh rm -rf /home/pas/upload/* mount -o username=pas,password=111111 //109.110.100.56/pas /media/smbdir/ cd /media/smbdir/ cp -r upload/* /home/pas/upload/
umount -l /media/smbdir/