linux crontab run on the last day of the month

2021. 4. 7. 13:46기타

728x90

If you still really want to run it on the last day of the month, one option is to simply detect if tomorrow is the first (either as part of your script, or in the crontab itself).

So, something like:

55 23 28-31 * * [[ "$(date --date=tomorrow +\%d)" == "01" ]] && myjob.sh

 

should be a good start, assuming you have a relatively intelligent date program.

 

 

stackoverflow.com/questions/6139189/cron-job-to-run-on-the-last-day-of-the-month

728x90
반응형