Web lists-archives.com

Re: A Rather Basic Cron Question




Thanks to both Greg Wooledge and Reco.  

Reco <recoverym4n@xxxxxxxxx> writes:
>         Hi.
> 
> On Thu, Aug 23, 2018 at 01:29:30PM -0500, Martin McCormick wrote:
> > */5 5-12,13-23 * * * sh -c ". $HOME/.master.env; ./etc/do_mail"
> ...
> >       In this case, no harm was done but shouldn't the cron
> > runs have stopped at 12:00 and then resumed at 13:00?
> 
> No, it should not. It's a classic 'off by one' mistake:
> 
> $ perl -e 'my @a = (eval "5..12,13..23"); print join ",", @a;'
> 
> 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
> 
> On the other hand,
> 
> $ perl -e 'my @a = (eval "5..11,13..23"); print join ",", @a;'
> 
> 5,6,7,8,9,10,11,13,14,15,16,17,18,19,20,21,22,23
> 
> So 5-11,13-23 should do what you want.

	I just wasn't thinking and even more, by specifying 1
hour of no runs, the effect would have been as if nothing had
happened.  The run at 12:55 would have satisfied the criteria for
all the runs associated with 12:00 and then 13:00 would have
started a whole new sequence of */5 runs, making the schedule
unbroken.

	By the way, that was a clever use of perl.

Martin