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

I found this setting on one production machine. And foo.sh was executed every one minute.

I am guessing that the original author of this setting wants it to be executed every one hour.

And I cannot find the official meaning of this setting in the crontab man page. Hence please help.

UPDATE:

I extracted these logs from that machine, however I cannot find the law out of them.

2013-06-29 20:47:01
2013-06-29 20:50:02
2013-06-29 20:51:01  
2013-06-29 20:53:01
2013-06-29 20:54:01  
2013-06-29 20:57:01  
2013-06-29 20:58:01  
2013-06-29 21:00:01
2013-06-29 21:05:02  
2013-06-29 21:10:02
share|improve this question
    
i think * in minute field means every minute,so changing that to 0 will fix this.So that foo.sh will be executed every hour. –  Kevin Parker Jun 29 '13 at 13:14

1 Answer 1

up vote 2 down vote accepted

Setting a start at the front will make the command run every single minute. the second */1 will be ignored. Normally you can set a value here to say: "Run this script every minute between 22:00 and 23:00.

The first star needs to be a 0:

0 */1 * * * sh foo.sh

If you set the * value it will match every minute. If you set the 0, it will execute every hour when the minutes of the current time equals to 0, so 01:00,02:00,03:00,...

If you set it to 15 like this:

15 */1 * * * sh foo.sh

It will execute every hour, 15 minutes past the hour. So at 01:15, 02:15,03:15,...

share|improve this answer
    
Yes, I always do that. But since this setting has already been in production, I want to know the actual behavior in this case. The interval was not exactly every one minute. –  aXqd Jun 29 '13 at 13:16
    
Normally it should run every minute. –  Lucas Kauffman Jun 29 '13 at 13:20
    
Thanks lucas, please see my updates. The result is really confusing to me. –  aXqd Jun 29 '13 at 13:23
    
*/1 is not ignored, it's just that it's the same as *. If it were * */2 * * *, it would execute at every minute of every other hour. –  sch Jun 29 '13 at 20:30

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.