cron behavior

Scott Lanning slanning at BUPHY.bu.edu
Mon Dec 31 13:08:43 EST 2001


On Mon, 31 Dec 2001, jbk wrote:
>I want my full backup script to run every fourth Monday and
>I thought the following sintax would do that, but this
>morning it ran again, this is the second Monday in the
>cycle.
>
>'15 4 * * 1/4 /etc/backup/backup monday
>>>/var/log/backup/tape.log'
>
>Does this syntax only work on the HOUR & DAYS_OF_MONTH
>fields? The man page doesn't say.

I found the cron manpage confusing until I realized you have to do

    $ man 5 crontab

to get the useful one. Reading that, I think 1/4 isn't right
because the '/4' is "used in conjunction with ranges".
'1' might techically be a range, but probably not what you
expected. I don't think there's a way to directly say
"every 4th Monday" (is there?), but I guess if you put
"day of month" to an appropriate range (22-28?) and "day of week"
to 1 (for Monday), then that might work.




More information about the Discuss mailing list