crontab:计划表,cron ,来源于希腊语”chronos”。
- 编辑计划任务
crontab -e
crontab命令有6部分组成:m(分) h(时) dayofmonth month dayofweek command。
- 查看计划任务
crontab -l
- 移除计划任务
crontab -r
- 查看/移除某个用户的计划任务
sudo crontab -u username -l/-r
字段 | 值 |
---|---|
minute | 0 - 59 |
hour | 0 - 23 |
day of month | 1 - 31 |
month | 1 - 12 |
day of week | 0 - 7(0 or 7 代表SUN) |
*(asterisk):头到尾
-(hyphen):8-11 = 8.9.10.11
1,2,3:允许1,2,3
*/2: 每两个小时