run script every last thursday of the month [duplicate]
How to make a script run at e.g. 16:00 every last thursday of the month using gnome-schedule or cron?
Solution 1:
Open crontab (crontab -e
)and add this entry.
0 16 24-31 * 4 script_file
You can use this online cron generator.
Hope this helps.
Solution 2:
Faced with the same issue I created a script (cron-last-sunday) to help with this.
Here is a brief example of how easy you can achieve these "peculiar" requirements.
# every first saturday
30 6 * * 6 root run-if-today 1 && /root/myscript.sh
# every last sunday
30 6 * * 7 root run-if-today L && /root/myscript.sh
# every third tuesday
30 6 * * 2 root run-if-today 3 && /root/myscript.sh