Re: Question about crontab

From: Bruce Harvey (BruceH@ROUTESCAPE.COM)
Date: Thu Sep 19 2002 - 07:35:47 EDT


Personally, I'd rather keep the complexity in a script than in a
system-level file. Less chance of anything "unusual" causing problems.
Just my cautionary outlook.

--------------------
Bruce T. Harvey, Special Projects Developer
Insight Distribution Systems, Hunt Valley, MD

-----Original Message-----
From: Sunder Iyengar [mailto:Sunder.Iyengar@VERITAS.COM]
Sent: Wednesday, September 18, 2002 7:19 PM
To: aix-l@Princeton.EDU
Subject: Re: [aix-l] Question about crontab

Here is another way to do this in the crontab file itself.

We specify the crontab line to run every Monday. However, since you need to
run the script only on the first Monday, the day will have to be between 1
and 7 (both inclusive). That is, the first Monday will be a day number
between 1 and 7 (or, to put it in another way, less than 8).

Specify the crontab line as follows -

0 23 * * 1 [[ $(date '+\%d') -lt 8 ]] && /path/myscript_to_run

The above specifies that the command will run on every Monday at 11 pm. The
command itself consists of two parts. The first part determines the day of
month. If this is less than 8, the second part is run, that is the script.
Please note that a backslash is required before any % signs in the crontab
entry.

Sunder.

-----Original Message-----
From: Drew Wrobel [mailto:Andrew_Wrobel@PEPBOYS.COM]
Sent: Tuesday, 17 September 2002 03:41
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