如果启用了anacron,谁在/etc/cron.hourly中运行脚本?
我已经读过,如果启用了anacron
, cron
不会在cron.weekly / hourly / daily / hourly中运行脚本,而不是运行它们两次。 因此, anacron
对该文件夹负责。
但是, anacron
不适用于每小时脚本。 那么,谁运行/etc/cron.hourly?
对不起,如果这是一个乞丐问题。
如果你看一下/etc/crontab
,你会看到:
17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
然后检查cron
的状态:
$ service cron status cron start/running, process 1041
anacron
本身不作为服务/守护进程运行,而是作为cron作业: /etc/cron.d/anacron
。 因此, cron
正在运行并检查每日,每周和每月任务是否存在anacron
,而不是每小时任务。 cron
运行每小时的任务。