vim /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# 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 * * * * ls 指定每小时的第5分钟运行一次ls命令
30 5 * * * ls 指定每天的 5:30 运行ls命令
30 7 8 * * ls 指定每月8号的7:30分运行ls命令
30 5 8 6 * ls 指定每年的6月8日5:30运行ls命令
30 5 8 6 * ls 指定每年的6月8日5:30运行ls命令
30 6 * * 0 ls 指定每星期日的6:30运行ls命令
30 3 10,20 * * ls 每月10号及20号的3:30运行ls命令
25 8-11 * * * ls 每天8-11点的第25分钟运行ls命令
*/15 * * * * ls 每15分钟运行一次ls命令
30 6 */10 * * ls 每一个月中。每隔10天6:30运行一次ls命令
22 4 * * * root run-parts /etc/cron.daily
20 23 * * * root rsync -avzP --delete --exclude-from "/home/wzz/exfile.txt" /jenkins_doc 192.168.0.51:/home/bakuser/jenkins/
#每天4:22以root身份运行/etc/cron.daily文件夹中的全部可运行文件,run-parts參数表示。运行后面文件夹中的全部可运行文件。
#每天23:20以root身份进行rsync备份