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 there a way to run a cron job once a minute for an hour every day?

I know I can probably make 60 cron jobs to do this but that would make it difficult if I ever needed to edit the job.

share|improve this question

migrated from stackoverflow.com Apr 4 '12 at 10:53

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

add comment

1 Answer 1

Sure:

*/1 4 * * * /home/scripts/my_job.sh

That tells it to run every minute during the 4 AM hour.

share|improve this answer
    
@ davidethell. that is cool. I never used it –  Jayan Apr 3 '12 at 11:24
    
Isn't the /1 redundant? –  Daniel Beck Aug 19 '12 at 13:22
    
Could you explain how the /1 works. Some other users would like to make it ever '15 minutes for 2 hours' say... –  Pureferret Sep 4 '12 at 21:47
    
@DanielBeck, yes, /1 is redundant. * will accomplish the same thing. –  davidethell Sep 5 '12 at 10:25
1  
@Pureferret, the /1 says every minute. To make it run every 15 minutes just to /15. For the hours you can specify a two hour range like 2-4. So this would work: */15 2-4 * * * –  davidethell Sep 5 '12 at 10:36
add comment

Your Answer

 
discard

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