When does `cron.daily` run?

Solution 1:

For the distributions you mention:

On CentOS 5.4 (Should be same for RHEL5)

grep run-parts /etc/crontab

01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

So cron.daily runs at 04:02am.

Same on CentOS 4.8

Solution 2:

From the man page:

 Cron also searches for /etc/anacrontab

/etc/anacrontab in my system (Fedora 12) :

1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly

See also man anacrontab


Solution 3:

For CentOS 6, you need to grep /etc/anacrontab and the answer varies if the server/laptop/dekstop/etc has been turned off or not.

cat /etc/anacrontab 
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1   5   cron.daily      nice run-parts /etc/cron.daily
7   25  cron.weekly     nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly        nice run-parts /etc/cron.monthly

So, between the hours of 3AM and 10PM** (after reboot and after the machine has been up for 5 minutes^^), run /etc/cron.daily. If there is no reboot, the job should run at 3:05AM++.

** As defined by START_HOURS_RANGE
^^ As defined by FIELD_TWO (i.e. the 5 after the 1 in the cron.daily line)
++ plus a random time between 0 and 45 minutes as defined by RANDOM_DELAY

Reference: http://linux.die.net/man/5/anacrontab


Solution 4:

For SuSE systems (specifically SLES 11.1 and openSuSE 10.3) the daily run time of the /etc/cron.daily scripts is controlled by the value of the DAILY_TIME variable set in the /etc/sysconfig/cron file.

If the DAILY_TIME variable is not set, it defaults to: (time of last boot + 15 minutes).


Solution 5:

On Ubuntu, you'll find a file /etc/crontab, from where this is configured. I guess it is something similar on RH and Centos.