Re: Cron Job Issue (391 Views)
Reply
Regular Advisor
itrc55
Posts: 195
Registered: ‎04-10-2010
Message 1 of 5 (427 Views)

Cron Job Issue

Hi,

 

Is there a way to set job to run first friday of every month at 12:00 am?

 

Thanks

Please use plain text.
Honored Contributor
Steven Schweda
Posts: 9,079
Registered: ‎02-23-2005
Message 2 of 5 (415 Views)

Re: Cron Job Issue

Please use plain text.
Regular Advisor
itrc55
Posts: 195
Registered: ‎04-10-2010
Message 3 of 5 (400 Views)

Re: Cron Job Issue

Hi,


Is there any way to schedule cron execution on every first friday each month ?

so far I'm using:
0 12 * * 5 /test.sh

but it's for every friday and shell handles this internally checking for existince some control files.

Thanks all.

Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,898
Registered: ‎03-06-2006
Message 4 of 5 (395 Views)

Re: Cron Job Issue

00 00 * * 5 /test.sh

 

>but it's for every Friday and shell handles this internally checking for existence some control files

 

As Steven said, you must check for the first Friday in your script:

if [ $(date +%e) -gt 7 ]; then

   exit 0

fi

Please use plain text.
Honored Contributor
Steven Schweda
Posts: 9,079
Registered: ‎02-23-2005
Message 5 of 5 (391 Views)

Re: Cron Job Issue

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation