bash - How to schedule to run first Sunday of every month -


i using bash on redhat. need schedule cron job run @ at 9:00 on first sunday of every month. did little research , see there no short hand in cron this.

do know of optimal way ?

you can put in crontab file:

00 09 * * 7 [ $(date +\%d) -le 07 ] && /run/your/script 

the date +%d gives number of current day, , can check if day less or equal 7. if is, run command.

if run script on sundays, should mean runs on first sunday of month.

remember in crontab file, formatting options date command should escaped.


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -