Ubuntu – the story behind the default times set in /etc/crontab


To my understanding, this is the default configuration of /etc/crontab:

# m h dom mon dow user  command
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 )

Why were these specific times chosen for the default entries?

At first I assumed that they are somewhat randomized on installation to even out the system load, but that doesn't seem to be correct.

Best Answer

Ubuntu started in 2004, and is based on Debian. By then, the current crontab was present, so we get to trace through Debian history to find its origins.

Here is the crontab from Debian 0.93R6 (November 1995). The hour is present, but the minute is different for the cron.daily entry:

# m h dom mon dow user  command
42 6    * * *   root    run-parts /etc/cron.daily
47 6    * * 7   root    run-parts /etc/cron.weekly
52 6    1 * *   root    run-parts /etc/cron.monthly

By Debian 2.1 (March 9, 2009), it changed. The cron.hourly entry isn't present yet, but the rest of the times are the same as they are currently:

25 6    * * *   root    run-parts --report /etc/cron.daily
47 6    * * 7   root    run-parts --report /etc/cron.weekly
52 6    1 * *   root    run-parts --report /etc/cron.monthly

Thankfully, Debian has changelogs, so we can see why this change was made. I've linked the bug number, which thankfully Debian keeps around:

  • Do cron.daily a little earlier, try to avoid overlap with cron.weekly (closes: Bug#23023) (from 3.0pl1-46)

Now, finding out where 6 AM and 47 and 52 came from, you'll have to follow back into pre-Debian history. I've checked the original Vixie Cron sources, and it doesn't appear to come from there.

As far as I can tell, SLS 1.03 didn't ship cron, but SLS 1.05 did. However, it doesn't appear to have come with an /etc/crontab, and the example in the manpage is different. Nor does it have a run-parts.

Looking at run-parts from Debian 0.93R6 (package miscutils), it seems its a Debian-specific tool (a short Perl script back then). So those cron lines probably originate from very early Debian development.

Related Question