Cron to Schedule a Script on Last Day of Month
00 01 28-31 * * [ "$(date +%d -d tomorrow)" = "01" ] && /script.sh
At 01:00 on every day-of-month from 28 through 31
00--> Minutes when you want to run
01--> Hour when the job needs to be executed
28-31--> 28,28,29 and 31’st of each month
*--> All month of year
*-->All day of week
/script.sh--> Script name which needs to be executed
[ "$(date +%d -d tomorrow)" = "01" ]--> Logic which will test if next date is 01
Post a Comment
Post a Comment