$ sudo cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- 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
# | | | | |
# * * * * * user-name command to be executed
*/5 * * * * root /root/bin/sync-tomcat.sh
*/5 * * * * root /root/bin/sync-web-data.sh
$ sudo cat /root/bin/sync-tomcat.sh
#!/bin/bash
rsync -avPAE --delete --exclude-from=/root/etc/rsync_exclude.list sync_is:/usr/share/tomcat6/webapps/ /usr/share/tomcat6/webapps/
$ sudo cat /root/etc/rsync_exclude.list
OTAManagement*
OTAWebService*
#!/bin/bash
rsync -avPAE --delete sync_is:/var/www/archive/ /var/www/archive/
以下解释了上面的sync_is在哪里定义。sync_is 后面的一个冒号表示通过ssh 通道;如果是两个冒号表示通过rsh 通道。
$ sudo cat /root/.ssh/config
host sync_is
HostName 11.11.111.111
User rsync
IdentityFile /root/.ssh/id_rsa.rsync