[Trilug-ontopic] CronTab exclusions

Alan Porter porter at trilug.org
Tue Jan 1 12:04:01 EST 2008


A couple of weeks ago, we were talking about crontabs with
day-of-month and day-of-week.  On Solaris systems, cron
OR's the two date fields together.  It turns out that Linux
works the same (counter-intuitive) way.

This morning, I noticed the fine print on the Linux crontab
(5) man pages, and it says the same thing!

    Commands  are executed by cron(8) when the minute, hour,
    and month of year fields match the current time, and when
    at least one of the two day fields (day of month, or day
    of week) match the current time.

That finally solves a mystery in my house... I have an old
PC running backuppc.  I have set it up to reboot every two
weeks... or so I thought.

    # Reboot every other Monday morning at 6am.
    00  6  1-7,15-21  *  1  /sbin/shutdown -r now

So, as written, it actually reboots every Monday AND every
day of every other week.  DOAH!


Alan








.



More information about the Trilug-ontopic mailing list