Re: Question about crontab

From: Green, Simon (SGreen@KRAFTEUROPE.COM)
Date: Tue Sep 17 2002 - 05:04:15 EDT


Are you sure about that? Unless things have changed in the last couple of
years, cron ORs, not ANDs. So that would end up running on the 1st through
7th, and on every Monday.

For the end of the month, I'd go with a script; otherwise someone is bound
to forget the leap year. Run it on 28th-31st and check what date tomorrow
is, using a suitable TZ. If tomorrow is the 1st, then today is the last day
of the month. For the last Tuesday of the month, check a week ahead and see
if the day is less than 8.

Simon Green
Philip Morris ITSC Europe

AIX-L Archive at http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2
AIX FAQ at http://www.faqs.org/faqs/aix-faq/

N.B. Unsolicited email from vendors will seldom be appreciated.
> -----Original Message-----
> From: Bruce Zimmer [mailto:b.r.zimmer@WORLDNET.ATT.NET]
> Sent: 16 September 2002 22:20
> To: aix-l@Princeton.EDU
> Subject: Re: Question about crontab
>
>
> By scheduling for the 1st, 2nd, 3rd, 4th, 5th, 6th and 7th
> and also the
> 1st day of the week (Monday) you can indeed schedule for the first
> Monday of the month. The cron parameters are ANDed together and will
> only run when all of the parameters match.
>
> If the first Monday is the 3rd then it will not run on the 1,
> 2, 4, 5, 6
> or 7th of the month but only on the 3rd. Likewise you can schedule on
> the 3rd Tuesday with
>
> * * 15-21 * 2 somejob
>
> Unfortunately the last someday of the month is much more difficult as
> months have the bad attribute of having variable number of days in a
> month. It is possible to work around it by having 3
> different lines in
> the crontab, and then changing the February line every 4 years



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:12 EDT