crond定时任务和at任务的用法

at定时任务
at 时间 回车
at>命令
at>ctrl+d 结束
例如

at 23:11
at > service httpd restart
at >ctrl+D
在23:11重启apache

at -l 或 at -atq      #查看at作业列表
at -d 或 atrm 作业号  #删除at作业

crond定时任务

crontab -e   #编辑任务
crontab -l 	#查看任务列表
crontab -r 	#移除任务
掌握crond的计划任务格式
crontab -e 
30  12 *  *  *  /etc/init.d/httpd restart #每天12:30重启apache
分 时 天 月 周 任务
3  12 6   7   *  /etc/init.d/httpd restart   #每年7月6号的12点3分重启apache
*/3  *  *  *  *      #每3分钟一次

猜你喜欢

转载自blog.csdn.net/zhangthree1/article/details/108351504