I have a cron job that needs to run every 10 minutes, but should not be run for an hour each night ( from 5 to 6am ) while the system is down for a backup.
As I understand it the following syntax should work in crontab
:
*/10 0,1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * * <command>
This is hardly a nice solution, is there a more efficient way to express my needs to cron?
In case it matters, the server is running RHEL 5.
Cron on RHEL supports lists, so you can just do this:
Use another service to shutdown cron service during that time. Maybe at?
Although David's idea sounds ... simpler.
Schedule the maintenance script with cron - let the script shutdown cron and at the end restart it again. No matter how long your maintenance script will take, no job will interfere. As soon as it is done everything is fine again and you may not even have missed a thing.
To allow for crasing maintenance script schedule a startup of cron service with at in now + x hours.