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"?

link|improve this question
feedback

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

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

3 Answers

up vote 1 down vote accepted

Yes Like so

* 13 * * * <your command>

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

link|improve this answer
That will (or would, since it has now been edited) run every minute between 1pm and 3pm – David Dorward 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
feedback

Just use a * for the minute specifier.

*      13       *       *       *      foo.sh
link|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). – David Dorward Sep 25 '11 at 7:11
;o) no problems – Steve Sep 25 '11 at 7:13
feedback
*/1      13       *       *       *      echo `date` > ~/cron.txt
link|improve this answer
feedback

Your Answer

 
or
required, but never shown