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.

Running a cron job every minute is easy, running it at specific minutes past the hour is easy.

But is it possible to say "only between 1300 and 1400 run every 1 minute"?

share|improve this question

migrated from stackoverflow.com Sep 29 '11 at 9:35

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers 3

up vote 4 down vote accepted

Yes Like so

* 13 * * * <your command>

See http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5

share|improve this answer
    
That will (or would, since it has now been edited) run every minute between 1pm and 3pm –  Quentin Sep 25 '11 at 7:07
    
I know - Too quick on the post button. Corrected it though. –  Ed Heal Sep 25 '11 at 7:08
add comment

Just use a * for the minute specifier.

*      13       *       *       *      foo.sh
share|improve this answer
    
Quentin, you say @Ed Heal's answer will run every minute 1pm - 3pm, but your answer is the same. Am I missing something? –  Steve Sep 25 '11 at 7:10
    
@Steve — That it has been edited since my comment (and within the "no history" grace period). –  Quentin Sep 25 '11 at 7:11
    
;o) no problems –  Steve Sep 25 '11 at 7:13
add comment
*/1      13       *       *       *      echo `date` > ~/cron.txt
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.