定时任务 crontab

定时计划任务
crontab -l 计划任务列表
crontab -e 编辑计划任务


sudo /usr/sbin/cron start 
sudo /usr/sbin/cron restart 
sudo /usr/sbin/cron stop

/:每
-:取值区间
,:取值

每天11.15执行clear.py
15 11 * * * python3 /Users/jiao/python/clear.py

45 4 1 , 10 , 22 * * /usr/local /etc/rc .d/lighttpd restart 
每月 1 10 22 日的 4 : 45 重启apache

10 1 * * 6 , 0 /usr/local/etc/rc.d/lighttpd restart 
每周六、周日的 1 : 10 重启apache

0 , 30 18 - 23 * * * /usr/local /etc/rc .d/lighttpd restart 
每天 18 : 00 23 : 00 之间每隔 30 分钟重启apache

0 11 4 * mon-wed /usr/local/etc/rc.d/lighttpd restart 
每月的 4 号与每周一到周三的 11 点重启apache

0 17 * * 1 - 5 mail -s "hi" alex @domain .name < /tmp/maildata
周一到周五每天 17 : 00 寄一封信给alex @domain .name

猜你喜欢

转载自blog.csdn.net/u012717420/article/details/80838379