Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 1997 19:50:23 -0400
From:      Shawn Carey <smc@servtech.com>
To:        "Daniel O'Callaghan" <danny@panda.hilink.com.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: crontab question
Message-ID:  <3354143F.41C67EA6@servtech.com>
References:  <Pine.BSF.3.91.970416093307.10264m-100000@panda.hilink.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel O'Callaghan wrote:
> 
> On Tue, 15 Apr 1997 smc@servtech.com wrote:
> 
> > What I'd like to do is set up a cron task that runs on either the first
> > or last Sunday of every month.  As an experiment, I've got:
> >
> > 0       14      *       *       0/4     root    mail -s "cron test" root
> >
> > This seems to be frustratingly close, but it leaves me guessing which
> > Sunday it will run on, and it hasn't been in long enough to run yet.
> 
> Which do you *want* it to run on?
> 
> 0       14      1-7      *       0     root    mail -s "cron test" root
> will run on the first Sunday.
> [...]

But won't it run every day of the first week, and every Sunday after
that also?
Only one of the two day fields needs to match in order for cron to run
the command.  Since I'll be using this to automate monthly backups, I'd
rather not accidentally chew on tapes that happen to be in the drives at
an unlucky moment! :-)

It seems to me that what I need is for cron to logically AND the
day-of-week and day-of-month fields instead of using logical OR.  Is
there any low down, dirty way to simulate this (short of hacking cron)?

Thanks,
-Shawn Carey



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3354143F.41C67EA6>