Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crontab Issue

Status
Not open for further replies.

MeganP

Programmer
Sep 23, 2004
18
US
Hi,
I have written the following script to schedule a job to run on 3rd Wednesday of every month, but It is executing on every Wednesday and every day between 15-21 dates. Can some one help me in fixing this bug. Any help is greatly appreciated!

00 16 15-21 * 3 /u11/cdw_prod/Script1.ksh

Thanks!
 
Try something like this:
00 16 15-21 * * [ `date +\%u` = 3 ] && /u11/cdw_prod/Script1.ksh

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Stefan, [ ] is a shorthand for test, not the same thing as [[ ]] in ksh-like shells.
And as we test numeric values I think the proper way is:
00 16 15-21 * * [ `date +\%u` -eq 3 ] && /u11/cdw_prod/Script1.ksh

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top