OT: Cron question

Jakob Østergaard jakob at unthought.net
Wed Feb 13 20:17:43 EST 2002


On Wed, Feb 13, 2002 at 07:16:03PM -0500, Robert G. Brown wrote:
...
> 
> 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...

Yep - someone else just pointed this out to me in private mail:  I somehow
managed to read the man-page 10 times without seeing the following:

       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, aren't *), the command will  be
       run when either field matches the current time.  For exam­
       ple,
       ``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.

 Duh !

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

<rant>
Yep.  The same "and" operator which is present between all other fields,
*except* for the last one....  I wonder what the logic behind this last
special rule would be...
</rant>

On second thought, I guess I should consider such peculiarities "charming"
rather than annoying - hey, if it was easy, it wouldn't be fun.   ;)

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

Yep - that looks like it will be the way to go.

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

Yup,  time to script...

Thanks a lot,

-- 
................................................................
:   jakob at unthought.net   : And I see the elder races,         :
:.........................: putrid forms of man                :
:   Jakob Østergaard      : See him rise and claim the earth,  :
:        OZ9ABN           : his downfall is at hand.           :
:.........................:............{Konkhra}...............:
_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf



More information about the Beowulf mailing list