NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: crontab fun
On Sat, Jul 05, 2008 at 12:01:55PM -0400, Chuck Swiger wrote:
> Patrick Welche wrote:
...
>> If the rule were _both_ and I wanted _either_, I could write 2 lines
>> in crontab. The opposite isn't obvious to me. A use case for _both_
>> would be "run this backup every Friday unless it's the first of the
>> month (because the different monthly backup is running)" - and I can't
>> believe I'm the first one to encounter this ;-)
...
> You might also look up Vixie cron, as that supports an extended syntax
> for specifying more complex rules.
It seems that we run Vixie cron 3 + patches. Looking at the version 4.1 shar
(now known as ISC cron), I see that I'm definitely no the first one to
encounter this :-)
XFrom: ames!seismo!cbmvax!devon!paul
XTo: cbmvax!seismo!nike!ptsfa!vixie!paul
XDate: Mon Jan 5 09:29:57 1987
...
XWhat this does is run 'command' on the 4th thru 31st days of the
Xmonth, AND on Monday thru Saturday; which probably means running it
Xevery day of the month (unless Sunday falls on days 1-3). This
Xhappens because cron runs the command if the day-of-month OR the
Xday-of-week is true.
X
XWhat I'd like to happen with the above line is to run the command ONLY
Xon Monday thru Saturday any time after the 3rd of the month, e.g. if
Xthe day-of-month AND the day-of-week are true.
...
X<< This message made me aware of the actual boolean expression involved
X in a crontab entry. I'd assumed that it was
X (minute && hour && DoM && month && DoW)
X But it's really
X (minute && hour && month && (DoM || DoW))
X
X I can see some value in changing this, but with a fixed order of
X fields, operators get to be kindof unary, which && and || really
X aren't. If someone has an idea on a syntax that allows useful
X variations to the standard (&& && && (||)) default, please suggest. >>
Cheers,
Patrick
Home |
Main Index |
Thread Index |
Old Index