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

Cron Job Issue

Hi,

 

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

 

Thanks

Honored Contributor
Steven Schweda
Posts: 9,091
Registered: ‎02-23-2005
Message 2 of 5 (505 Views)

Re: Cron Job Issue

Regular Advisor
itrc55
Posts: 195
Registered: ‎04-10-2010
Message 3 of 5 (490 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.

Acclaimed Contributor
Dennis Handly
Posts: 25,207
Registered: ‎03-06-2006
Message 4 of 5 (485 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

Honored Contributor
Steven Schweda
Posts: 9,091
Registered: ‎02-23-2005
Message 5 of 5 (481 Views)

Re: Cron Job Issue

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.