Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What is the crontab syntax for specifying running hours/minutes based on the day of the week in a single entry?

There's a task which needs to be executed every /1 minute from Monday,01:00 to Saturday,01:00, so after specifying the days (1-6) I still have to exclude 00:00-00:59 from Monday and 01:00-23:59 from Sunday.

I don't want to keep it done with three entries instead of one; doing additional time check via some wrapper script is also not a good option.

Cron flavor: vixie-cron, could be changed to another if required.

share|improve this question

1 Answer 1

You can't do this cron isn't that smart as you mention you will need 3 lines

#Mon
* 1-23 * * 1 task
#Tue to Sat
* * * * 2-6 task
# Sun 
* 1 * * 0 task

or something similar.

share|improve this answer
    
Should be 2-6 for Tuesday to Saturday. 2,6 is Tuesday and Saturday –  faker Jun 18 at 13:48

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.