[Techtalk] cron help

Conor Daly c.daly at met.ie
Fri Jul 23 09:17:45 EST 2004


On Thu, Jul 22, 2004 at 05:24:39PM -0700 or thereabouts, vatsan wrote:
> > -----Original Message-----
> > From: Maria McKinley
> > 
> > to see if anyone knows off-hand.  If I do the following cron job:
> > 
> > 00 11 1 * 1 /root/lab.monthly
> > 
> > Will it execute at 11 am on the first Monday of every month, or only on
> > months where the first is also a Monday?  I'm guessing the latter, but
> > hoping there is a way to get something to execute like the former...
>
> It will run at 11:00 am on the 1st of every month, as well as on every
> Monday. 

And to make it run as desired, either modify it like this (if it's a script)
or make a wrapper script to run it (assumes bash):

if [ `date +"%d"` -gt 7 ]; then
  echo "Not the first monday, quitting"
  exit 0
fi
..

and set your crontab to :

00 11 * * 1 /root/lab.monthly

Conor
-- 
Conor Daly,                   Please avoid sending me 
Met Eireann, Glasnevin Hill,  Word or PowerPoint attachments.
Dublin 9, Ireland             http://www.fsf.org/philosophy/no-word-attachments.html
Ph +3531 8064276 Fax +3531 8064247


**********************************************************************
This e-mail and any files transmitted with it are confidential 
and intended solely for the addressee. If you have received
this email in error please notify the sender.
This e-mail message has also been scanned for the
presence of computer viruses.
**********************************************************************



More information about the Techtalk mailing list