OT: Cron question

Robert G. Brown rgb at phy.duke.edu
Wed Feb 13 16:16:03 PST 2002


On Wed, 13 Feb 2002, Jakob Østergaard wrote:

> 
> Hello Wulfers:
> 
> Sorry for posting OT here, but I know that you know what I'm doing
> wrong here   :)
> 
> Problem:  I want cron to run job A every day, with one exception:
> I want to run job B the first friday every month, and I do not
> want job A to run on that particular day.
> 
> Yes, it's for running backups  ;)

Dunno.  Perhaps it is (from man 5 crontab, emphasis added):

...and when AT LEAST one of the two day fields (day of month, OR day of
week) match...

This seems like it would run every friday, right, since it matches day
of week 5, regardless of whether or not it matches your day of month
range.  It would need an "and" operator to do what you want.

In the face of it not working (and I don't see any simple cron recipe
that will do what you want) there are simple and obvious solutions.
Instead of running either job A or job B, run a simple script that runs
every Friday, looks at the date, and then runs A or B.

Making cron work at this level of detail may be possible.  May not.
Either way, I know how /bin/sh (or perl) and date and so forth work and
they add negligible overhead to this kind of chore.  There are always
lots of ways to do things.  Pick the easiest.

   rgb

-- 
Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu






More information about the Beowulf mailing list