CronTab命令实例



每2分钟 将date写入到time.log(以下的为奇数分钟运行)
*/2 * * * * date >> ~/time.log
1-59/2 * * * * date >> ~/time.log

每天的23:30分重新启动apache
30 23 * * *   /etc/init.d/apache2 restart
每月的1,10,20号的23:30分重新启动apache
30 23 1,10,20 * * /etc/init.d/apache2 restart

每月的1到15号的23:30重新启动apache
30 23 1-15 * * /etc/init.d/apache2 restart

晚上23点到早上6点之间每30分钟启动一次apache
*/30 23-7 * * * /etc/init.d/apache2 restart
0,30 23-7 * * * /etc/init.d/apache2 restart
0-59/30 23-7 * * * /etc/init.d/apache2 restart






原文地址:https://www.cnblogs.com/wzzkaifa/p/6900949.html