Re: Cron Job Issue (547 Views)
Reply
Regular Advisor
Posts: 195
Registered: ‎04-10-2010
Message 1 of 5 (583 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,121
Registered: ‎02-23-2005
Message 2 of 5 (571 Views)

Re: Cron Job Issue

Regular Advisor
Posts: 195
Registered: ‎04-10-2010
Message 3 of 5 (556 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: 25,711
Registered: ‎03-06-2006
Message 4 of 5 (551 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
Posts: 9,121
Registered: ‎02-23-2005
Message 5 of 5 (547 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.