Quantcast
Channel: CRON job to run on the last day of the month - Stack Overflow
Viewing all articles
Browse latest Browse all 23

Answer by Rakesh Chintha for CRON job to run on the last day of the month

$
0
0

The last day of month can be 28-31 depending on what month it is (Feb, March etc). However in either of these cases, the next day is always 1st of next month. So we can use that to make sure we run some job always on the last day of a month using the code below:

0 8 28-31 * * [ "$(date +%d -d tomorrow)" = "01" ] && /your/script.sh

Viewing all articles
Browse latest Browse all 23

Latest Images

Trending Articles





Latest Images