cron什么时候执行每日脚本?

如果我在/etc/cron.daily/放置一个shell脚本,它会在一天的什么时间执行?

查看/etc/crontab它应该在06:25运行。

 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 ) 

大约早上7:35,但确切的时间将取决于anacron。

默认情况下,cron将/etc/cron.daily作业的运行委托给anacron。 / etc / crontab包含以下行:

 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 

但这定义了未安装 anacron时的行为

安装anacron后,cron.daily作业的运行由/ etc / anacrontab中的条目控制:

 1 5 cron.daily nice run-parts --report /etc/cron.daily 

这表示每天运行一次这些工作,延迟5分钟。

anacron本身由cron运行,如文件/etc/cron.d/anacron中所指定,该文件在早上7:30运行anacron。

如其他答案所示,结果取决于是否安装了anacron。 在桌面上,它默认安装,但关键是它没有安装在服务器分发中。 所以答案是在服务器上大约06:25左右,在桌面上大约是07:35。