Re: Cron Job Issue (577 Views)
Reply
Regular Advisor
Posts: 195
Registered: ‎04-10-2010
Message 1 of 5 (613 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
Posts: 9,161
Registered: ‎02-23-2005
Message 2 of 5 (601 Views)

Re: Cron Job Issue

Regular Advisor
Posts: 195
Registered: ‎04-10-2010
Message 3 of 5 (586 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
Posts: 26,008
Registered: ‎03-06-2006
Message 4 of 5 (581 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

Highlighted
Honored Contributor
Posts: 9,161
Registered: ‎02-23-2005
Message 5 of 5 (577 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.