Question: How to run a cronjob on a specific day of the week or a range of days of the week?
To run a cron job on specific days of the week, you can specify this via the following:
1. Edit the crontab for the user wishes to create the crontab job for. For example:
# crontab -e
Then add an entry specifying the date and time and day of the week you wish to run the crontab job on. For example:
This crontab entry runs the script at 17:00 (5PM) on Saturdays:
0 17 * * 6 /script/script.sh
This crontab entry runs the script at 17:00 (5PM) on Sunday through to Friday:
0 17 * * 0-5 /script/script.sh
2. There’s more detail on the different crontab options in the man pages, specifically:
# man 5 crontab
3. However, days of the week can be specified in the rightmost number in the above examples with values of 0 to 7 representing each day of the week and Sunday being able to specified by either 0 or 7.