whi*_*edb 3 scripts cron anacron
我读过,如果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 )
Run Code Online (Sandbox Code Playgroud)
然后检查状态cron
:
$ service cron status
cron start/running, process 1041
Run Code Online (Sandbox Code Playgroud)
anacron
本身不作为服务运行/守护,但作为一个cron作业:/etc/cron.d/anacron
。因此,cron
正在运行,检查是否anacron
存在对每日,每周和每月的任务,而不是为每小时任务。cron
运行每小时任务。