Monday, August 3, 2015

How to run a cronjob on the last day of the month

You may have to escape the % sign for direct crontab entry depending on your cron software.  The example runs on the first minute of the last day of the month and starts trying for last day on the 28th (to deal with Feb).

0 0 28,29,30,31 * * [ $(date +\%d -d tomorrow) = “01” ] && command_you_want_to_run