One of our DBAs created the following crontab entry to run a backup every 3 hours starting 6:30 AM to midnight every day:
30 6-24/3 * * * (path to backup script)
Cron took the entry but did not run the backup as expected. I am not a sysadmin or a Linux expert. My analysis is that the entry should have been (since hour never equals 24):
30 6-23/3 * * * (path to backup script)
- Which entry is correct? If the first entry is wrong, why did crontab allow the DBA to create the entry? It should have thrown an error.
- If I wanted to create an entry to run backup every 3 hours starting 6:30 AM to 11:30 PM, how would I create a crontab entry? There is no example which shows a time range which ends on half hour.
Edit: the system is Oracle Enterprise Linux 5.
The script only ran once before 2300. I will do some more testing and post back. I am still confused how cron accepted illegal value for hour (24).
This is weird. If I create an entry like:
30 6-24/3 * * * /bin/ls
I cannot save crontab. I get an error that hour is bad. If I create an entry like:
30 6-24/4 * * * /bin/ls
I can save the entry. It does not make sense. The hour is still bad and is accepted. Is this a bug or an expected behavior?
MadHatter: Please feel free to change the title of the post and file a bug. As I said, I am not a Linux expert, just someone that co-workers discuss technical issues with. I really like this site. The contributors are knowledgeable and willing to help.
Thanks, Arun