Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] Historical origin of cron's day-of-month/weekday behavior?



One thing that's always annoyed me about cron is how it handles the
weekday field differently from the other fields. The first four fields,
minute, hour, day-of-month, and month, are logically ANDed, but
the day-of-month and weekday fields are ORed.

The man page describes the behavior, but does not explain the
reasoning behind it:

>     Note: The day of a command's execution can be specified by two fields --
>     day of month, and day of week.  If both fields are restricted (ie, are
>     not *), the command will be run when either field matches the current
>     time.  For example, ``30 4 1,15 * 5'' would cause a command to be run at
>     4:30 am on the 1st and 15th of each month, plus every Friday.

I've looked for an explanation for this in the past, but I've never
had any luck finding one. Making this a special case makes the code
needlessly more complicated and fragile, and it sacrifices useful
functionality; if the weekday had been ANDed like the other fields,
it would be trivially easy to specify things like "third Wednesday
of the month".

 I'm unable to find or think of a use case that would make the special
behavior useful, and I have to wonder why it was designed this way.

Can anyone point me to the original author's thoughts on this?



-- 
John Abreau / Executive Director, Boston Linux & Unix
Email jabr at blu.org / WWW http://www.abreau.net / PGP-Key-ID 0xD5C7B5D9
PGP-Key-Fingerprint 72 FB 39 4F 3C 3B D6 5B E0 C8 5A 6E F1 2C BE 99



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org