Cron scripts order of processing

James Gray james.gray at dot.com.au
Mon Apr 2 00:45:20 UTC 2007


On Sun, 1 Apr 2007 10:37:19 am Chris wrote:
> Hi there folks.
>
> What is the order of process of the scripts within /etc/cron.daily,
> weekly, monthly?
>
> I assume it's alphabetically?

Correct, in a way. Read below.

> I'm creating some maintenance scripts (for 
> some nightly backup routines along with virus scanning etc) and I would
> like to know the order of process so I can continue the proper flow -
> unless it really does not matter.

The /etc/cron.{daily,weekly,monthly} "scripts" are actually scheduled 
by "anacron" which in turn uses "run-parts" to execute the scripts inside the 
directories.  SO, the order of execution is governed by the "run-parts" 
program.  According to run-parts' man page:

"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."

So the question is what is "lexical order"?  Basically, the same order that 
characters are encoded in ASCII.  So white-space comes first, then symbols, 
then numbers, then CAPITALS, then lower case.

Read the man page for run-parts as there are some restrictions with file 
names - certain executeables will not be executed if their file names are 
not "allowed".  There are some other gotcha's too, so read the man page :)

Cheers,

James
-- 
It would seem that evil retreats when forcibly confronted.
		-- Yarnek of Excalbia, "The Savage Curtain", stardate 5906.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1357 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070402/25ac9b83/attachment.bin>


More information about the ubuntu-users mailing list