[Techtalk] Age-old cron problem

Nicoya Helm nicoya at nicoya.org
Mon Dec 10 13:54:44 UTC 2007


> -------- Original Message --------
> Subject: Re: [Techtalk] Age-old cron problem
> From: "Wim De Smet" <kromagg at gmail.com>
> Date: Mon, December 10, 2007 6:26 am
> To: techtalk at linuxchix.org
> 
> 
> On Dec 10, 2007 11:09 AM, Conor Daly <c.daly at met.ie> wrote:
> > [...]
> > Every second Sunday, OTOH, looks possible.
> >
> >        23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"
> >        5 4 * * sun     echo "run at 5 after 4 every sunday"
> >
> > So, by inference,
> >
> >        5 4 * * sun/2     echo "run at 5 after 4 every second sunday"
> >
> > should work?
> 
> Don't think so as /2 is supposed to be only a shorthand for ranges,
> i.e. 0-12/2 = 0,2,4,6,8,10,12. I don't think it applies here. I'd
> think the way to go would be to run every Sunday then check for
> yourself.
> 
> greets,
> Wim
> 

Yes, the sun/2 was one of my original hopes, but I couldn't confirm that
day-of-week responded to this the same as other fields.  My testing of
it failed, which I believe is what it should.

I think I will try this approach: via script, write a date to a file
somewhere on the starting Sunday as a reference for a counter.  In that
same script, put in logic to increment the date counter by one (i.e.
day) then test to see if we have reached the max (14 days).  If we have,
run the required Every-Other-Sunday-action, then reset counter.  Rinse
and repeat.  This will still require a manual kick-off on the first
Sunday, but after that should run every 14 days, i.e. every other
Sunday.

When I get something working, I'll post back to the list in case it's of
help to anyone else.  My goal in the future is to implement a wider
management infrastructure like Puppet or Zen Linux Management which can
do this type of task scheduling more easily.




More information about the Techtalk mailing list