Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Yes it is.

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

share|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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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