[plug] Crontab

Russell Steicke r.steicke at bom.gov.au
Wed Sep 26 17:00:39 WST 2001


On Wed, Sep 26, 2001 at 04:32:47PM +0800, Steve Grasso wrote:
> Hi Mike,
> 
> At 02:46 PM 9/26/01 +0800, you wrote:
> >On Wed, 26 Sep 2001, Steve Grasso wrote:
> >
> >> So Monday would be 1 and the syntax for every other Monday would be:
> >>
> >> 0 23 * * 1/2 script
> >
> >"Oh no it isnt."   (see my earlier post, or rtmp again)
> 
> Yup. You're right. A second rtmp was useful. Short of patching cron,
> Andrew's idea of a file toggle seems the best bet. I've done that with perl
> scripts in the past to achieve better than cron's usual 1 minute resolution.

A better idea (IMHO) would be to use the week number, which is available
with a %U, %V or %W expando in the date command's format string. ie

  $ date +%W
  39
  $

Then just test for this number being odd or even.  You may have to
handle year changeovers specially.

python has the same thing in (see time.strftime()), and it's bound to be
in perl as well, and almost any other reasonable scripting language.

This way you don't have to keep state lying around in your filesystem
between runs.

> Steve

-- 
Russell Steicke

-- Fortune says:
Edwin Meese made me wear CORDOVANS!!



More information about the plug mailing list