- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to set cron job to run last Thursday of every month at 2:00 AM
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

* * * * *, correspond to minute hour day month day-of-week.
0 2 25-31 * 4
- 2am, on the thursday between dates 25 to 31,
Sekar
PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

0 2 25-31 * 4
Can be read as: @ 2am, On days 25-31, every month, on Thursday
Hopefully there wont be more than one Thursday between 25th and 31st... call me if so 😉
It just so happens that the current month is a great example of how the 25th might be the last Thursday.
However, this will probably fail on some months with less than 31 days. So you really need one alert for each month:
0 2 25-31 1 4 = Jan
0 2 22-28 2 4 = Feb (will not work on all leap years)
0 2 25-31 3 4 = Mar
0 2 24-30 4 4 = Apr
0 2 25-31 5 4 = May
0 2 24-30 6 4 = Jun
0 2 25-31 7 4 = Jul
0 2 25-31 8 4 = Aug
0 2 24-30 9 4 = Sep
0 2 25-31 10 4 = Oct
0 2 24-30 11 4 = Nov
0 2 25-31 12 4 = Dec
Which simplifies to this:
0 2 25-31 1,3,5,7,8,10.12 4 = Jan, Mar, May, Jul, Aug, Oct, Dec
0 2 22-28 2 4 = Feb (will not work on all leap years)
0 2 24-30 4,6,9,11 11 4 = Apr, Jun, Sep, Nov
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I believe this is not quite correct, as it will run on days 25-31 AND on Thursdays. There is no way to do that easily that I know of.
