Re: Question about crontab

From: Bruce Zimmer (b.r.zimmer@WORLDNET.ATT.NET)
Date: Mon Sep 16 2002 - 17:20:16 EDT


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

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
Stephen Murphy
Sent: Monday, September 16, 2002 2:05 PM
To: aix-l@Princeton.EDU
Subject: Re: Question about crontab

Cron can schedule things for Monday or the first of the month but not
the
first Monday as you require. What I would do is to schedule a script
with
cron to run every Monday at 11PM and if the date was 7 or less, produce
the
report, otherwise produce nothing and exit.

--
*-----------------------------------------------------------------------
----
*
  Stephen T. Murphy
  Manager, Database and Technical Support
  University Business Systems - MSC-100
  The University at Albany, S.U.N.Y
  Albany,  New York    12222
  Phone: (518) 437-4523     Fax: (518) 437-4540
  MailTo:SMurphy@UAMail.Albany.EDU     AIM: SMurphy199
-----Original Message-----
From: Drew Wrobel [mailto:Andrew_Wrobel@PEPBOYS.COM]
Sent: Monday, September 16, 2002 1:41 PM
To: aix-l@Princeton.EDU
Subject: Question about crontab
     I have a need to run a script at 11pm on the first monday of every
month.
     I'm a bit confused as to what the crontab entry should look like.
     I know what the entry would look like for the first of the month,
run
a script
on a monday.  But not on the first monday of every month.
     Am I just confused or is this logical that would need to be put
into
the script?
     Thanks


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