Cron scripts order of processing

Marius Gedminas marius at pov.lt
Sun Apr 1 11:19:19 UTC 2007


On Sat, Mar 31, 2007 at 07:37:19PM -0500, Chris wrote:
> What is the order of process of the scripts within /etc/cron.daily,
> weekly, monthly?

These are not run directly by cron, but by rules in /etc/crontab:

17 * * * *  root  run-parts --report /etc/cron.hourly
25 6 * * *  root  test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
47 6 * * 7  root  test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly
52 6 1 * *  root  test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly

As you can see, when anacron is installed the three last rules are
replaced by the ones in /etc/anacrontab:

# These replace cron's entries
1       5       cron.daily       nice run-parts --report /etc/cron.daily
7       10      cron.weekly      nice run-parts --report /etc/cron.weekly
@monthly        15      cron.monthly nice run-parts --report /etc/cron.monthly

In any case, it is run-parts that processes the scripts in /etc/cron.*.
run-parts(8) says:

       Files are run in the lexical sort  order  of  their  names  unless  the
       --reverse  option  is given, in which case they are run in the opposite
       order.

which answers your question.

> I assume it's alphabetically?

That's right.

Marius Gedminas
-- 
Westheimer's Discovery:
        A couple of months in the laboratory can
        frequently save a couple of hours in the library.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070401/d796644c/attachment.sig>


More information about the ubuntu-users mailing list