NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: crontab fun

Patrick Welche wrote:
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

My goodness, an email with UUCP bang-paths from 21 years ago!  :-)

Well, if a decent solution hasn't been provided since then, I might as well flesh out the details of something which could do the job:

30 1 * * 5      /usr/local/bin/ crontab which runs this:

#! /bin/sh

if [ `date +%d` -lt 5 ]; then

[ s/5/6 if your "friday backup" happens early Saturday morning... ]


Home | Main Index | Thread Index | Old Index