At what time does cron execute daily scripts?

Solution 1:

Approximately 7:35am, but the exact timing will depend on anacron.

By default cron delegates the running of /etc/cron.daily jobs to anacron. /etc/crontab contains the line:

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

but this defines the behaviour if anacron is not installed

With anacron installed, the running of cron.daily jobs is controlled by the entry in /etc/anacrontab:

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

which says run these jobs once per day, with a delay of 5 minutes.

anacron itself is run by cron, as specified in the file /etc/cron.d/anacron, which runs anacron at 7:30am.

Solution 2:

Looking at /etc/crontab it should run at 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 )

Solution 3:

As indicated by other answers, the result depends on whether anacron is installed. On a desktop, it is installed by default, BUT crucially it is not installed in the server distribution. So the answer is around 06:25 on a server and about 07:35 on a desktop.

Solution 4:

To elaborate on the other answers, on newer systems anacron is managed by systemd. On my Ubuntu 19.10 system anacron runs from 7:30 - 23:30 every hour, with a randomized delay of 5 minutes. Anacron then runs cron.daily scripts with a 5 minute delay as defined in /etc/anacrontab.

In addition to that systemd only starts anacron when the system is connected to AC power. Have a look at /lib/systemd/system/anacron.service and /lib/systemd/system/anacron.timer for more info.