General
cancel
Showing results for 
Search instead for 
Did you mean: 

Cron schedule for every last monday of every month

Sridhar
Occasional Contributor

Cron schedule for every last monday of every month

Hi

   I am planning to scheduled a cron job which need to run every 4th monday of every month @ 8 Am. Can  any one help me on this..

 

 

0 08 23-31 * 1 <script>  

 

Is this correct or any modification needed.

4 REPLIES
V. Nyga
Honored Contributor

Re: Cron schedule for every last monday of every month

I believe it's day 22-28 (check August 2011 and November 2011 as the first and last possibility of 'every 4th monday of every month)

V.
*** Say 'Thanks' with Kudos ***
donna hofmeister
Trusted Contributor

Re: Cron schedule for every last monday of every month

you can't do what you're wanting strictly with cron.

 

you need to add coding within your script to test the date to know whether or not to proceed.

V. Nyga
Honored Contributor

Re: Cron schedule for every last monday of every month

Donna is right - at least the search function is also not that bad, check this one:
http://h30499.www3.hp.com/t5/System-Administration/cron-on-3rd-friday/m-p/3075377#M141529

*** Say 'Thanks' with Kudos ***
Dennis Handly
Acclaimed Contributor

Re: Cron schedule for every last Monday of every month

>at least the search function is also not that bad

 

Right.

Note: that last Monday isn't the same as 4th Monday.

And to make your script simple, include the date range in crontab and check for Monday in your script:

0 08 25-31 * * <script>  last

0 08 22-28 * * <script>  4th