Re: Question about crontab

From: Bruce Zimmer (b.r.zimmer@WORLDNET.ATT.NET)
Date: Tue Sep 17 2002 - 10:04:15 EDT


My mistake, I had used crontab like this on a UNISYS SVR4 system and it
did an AND, I guess I should have checked it out, as UNISYS did do a
number of thing slightly different than other Unicies.

Bruce Zimmer
Central Data Systems
(248) 615-4644 (direct)
(248) 705-9231 (cell)
bzimmer@centraldata.com

-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of
Saxon, Lamar
Sent: Tuesday, September 17, 2002 8:00 AM
To: aix-l@Princeton.EDU
Subject: Re: Question about crontab

Simon is correct. The fields are treated as an or. From the crontab
man
page:

The specification of days may be made by
    two fields (day of the month and day of the week). If you specify
both
as a
    list of elements, both are adhered to. For example, the following
entry:

    0 0 1,15 * 1 command

    would run command on the first and fifteenth days of each month, as
well
as
    every Monday. To specify days by only one field, the other field
should
    contain an * .

Lamar

-----Original Message-----
From: Green, Simon [mailto:SGreen@KRAFTEUROPE.COM]
Sent: Tuesday, September 17, 2002 4:04 AM
To: aix-l@Princeton.EDU
Subject: Re: Question about crontab

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