Is it possible to make a cron job run say, every 20 minutes, but make it not run for say, 1-4 in the morning.

link|improve this question

73% accept rate
feedback

2 Answers

up vote 5 down vote accepted

Yes it is.

0,20,40 0,5-23 * * * /job/to/run

link|improve this answer
Might want 0,4-23 there depending on whether you want it to not happen until the end of 4 or at the beginning. – Ignacio Vazquez-Abrams Apr 9 '10 at 21:05
Might want to add 'refer to the man page`: ss64.com/bash/crontab.html – DaveParillo Apr 9 '10 at 21:53
feedback

Don't forget that if you need more specific or complicated rules that can't be covered by the version of cron you're using, you can always write a small shellscript wrapper which will check the date +%H or other relevant statuses.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.