1
2
3
4
5
6
7
8
9
10
11
| Options:
-u <user> define user
-e edit user's crontab
-l list user's crontab
-r delete user's crontab
-i prompt before deleting
-n <host> set host in cluster to run users' crontabs
-c get host in cluster to run users' crontabs
-s selinux context
-x <mask> enable debugging
|
1
2
3
4
5
6
7
8
9
| Cron Express:
.---------------- 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
| | | | |
* * * * * [who(用户)] [command(执行脚本) | run-parts(执行指定文件夹下的脚本)]
|
1
2
3
4
5
6
7
8
9
| # 每小时(第一分钟)执行/etc/gomyck内的脚本
01 * * * * root run-parts /etc/gomyck
# 每两个小时, 以 root 用户执行 echo
0 */2 * * * root echo "Hello" >> /home/demo.txt
# 10 点 10 分执行两个命令, 命令之间以 ; 间隔
10 10 * * * (rm -rf /var/demo.txt;touch demo.txt)
|