我的系统是CentOS 6.3,我注意到我的/etc/cron.daily没有在凌晨4点01分执行,相反,这些脚本随机执行。 我search,似乎是“anacron”,搞砸了我的crontab。 例如,这些是来自/ var / log / cron的日志文件的一部分:
Oct 1 04:01:01 xfiles anacron[7350]: Anacron started on 2012-10-01 Oct 1 04:01:01 xfiles anacron[7350]: Will run job `cron.daily' in 18 min. Oct 1 04:01:01 xfiles anacron[7350]: Jobs will be executed sequentially Oct 1 04:01:01 xfiles run-parts(/etc/cron.hourly)[7352]: finished 0anacron Oct 1 04:19:01 xfiles anacron[7350]: Job `cron.daily' started Oct 2 03:01:01 xfiles anacron[8810]: Anacron started on 2012-10-02 Oct 2 03:01:01 xfiles anacron[8810]: Will run job `cron.daily' in 36 min. Oct 2 03:01:01 xfiles anacron[8810]: Jobs will be executed sequentially Oct 2 03:01:01 xfiles run-parts(/etc/cron.hourly)[8812]: finished 0anacron Oct 2 03:37:01 xfiles run-parts(/etc/cron.daily)[10133]: starting 00webalizer Oct 3 03:01:01 xfiles anacron[14989]: Will run job `cron.daily' in 30 min. Oct 3 03:01:01 xfiles anacron[14989]: Jobs will be executed sequentially Oct 3 03:01:01 xfiles run-parts(/etc/cron.hourly)[14991]: finished 0anacron Oct 3 03:31:01 xfiles anacron[14989]: Job `cron.daily' started Oct 3 03:31:01 xfiles run-parts(/etc/cron.daily)[16301]: starting 00webalizer Oct 4 03:01:01 xfiles anacron[16357]: Will run job `cron.daily' in 12 min. Oct 4 03:01:01 xfiles anacron[16357]: Jobs will be executed sequentially Oct 4 03:01:01 xfiles run-parts(/etc/cron.hourly)[16359]: finished 0anacron Oct 4 03:13:01 xfiles anacron[16357]: Job `cron.daily' started Oct 4 03:13:01 xfiles run-parts(/etc/cron.daily)[16692]: starting 00webalizer Oct 5 03:01:01 xfiles anacron[19413]: Will run job `cron.daily' in 29 min. Oct 5 03:01:01 xfiles anacron[19413]: Jobs will be executed sequentially Oct 5 03:01:01 xfiles run-parts(/etc/cron.hourly)[19415]: finished 0anacron Oct 5 03:30:01 xfiles anacron[19413]: Job `cron.daily' started Oct 5 03:30:01 xfiles run-parts(/etc/cron.daily)[20086]: starting 00webalizer
你可以看到/etc/cron.daily不能在固定的时间启动。 有时在3点半,有时在3点13分,有时在3点37分,或4点19分…
在以前的CentOS(5.x)中,/etc/cron.daily正确地从4:01开始。 但是我无法想象CentOS6的anacron如何lockingcron时间表。 如何让系统像CentOS 5.x一样运行,只在固定的时间(比如4:01)启动/etc/cron.daily?
谢谢。
(这是一个24/7服务器,没有closures问题)
如果你的/etc/anacrontab RANDOM_DELAY中设置了/etc/anacrontab ,那就是预期的行为。
从手册页 anacrontab(5)逐字复制:
如果设置了RANDOM_DELAY环境variables,那么0到RANDOM_DELAY分钟之间的随机值将被添加到作业的启动延迟。 例如,设置为12的RANDOM_DELAY将随机地在0到12分钟之间添加到用户定义的延迟。
这可能会解释你的症状。
安装cronie-noanacron按照说明在这里 ,你很好去。