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.

If I do this:

*/9 * * * * /path/to/wotnot

At what times will the task run in two hours, starting at 09h00

Is it A:

09h00
09h09
09h18
09h27
09h36
09h45
09h54
10h03
10h12
10h21
10h30
10h39
10h48
10h57

or B:

09h00
09h09
09h18
09h27
09h36
09h45
09h54
10h00
10h09
10h18
10h27
10h36
10h45
10h54
share|improve this question

2 Answers 2

up vote 30 down vote accepted

When looking at a range, you interpret it within only that column, so '*/9' within the minutes column means "list every minute, then select every ninth value". This selection resets at the top of the hour, so you restart at xx:00, xx:09, xx:18, etc every hour.

It can also be read as "every nine minutes of every hour", implying the reset at the top of the hour.

So the actual behavior you'll see corresponds to option B.

share|improve this answer
    
This is the only answer that seems to actually answer the question. Did you try this to make sure? –  gparent Jan 10 '13 at 14:29
    
Within the past 10 minutes? No. Within the past three months? Yes, though not specifically at a nine minute interval. –  John Jan 10 '13 at 14:30
    
Don't see why I would care when you did but only if. Thank you. –  gparent Jan 10 '13 at 14:31
1  
I've had former coworkers get pissy about "no you didn't test it, you're relying on your faulty memory!" in similar situations (of course, 5 minutes later they walk away annoyed after I prove that it still works), so I've formed a habit of hedging against that in advance. –  John Jan 10 '13 at 14:33
2  
The first step in testing is to ensure that you have the same brand and version as the customer (in this case Jesse). I don't see any clue here so far about what cron he's using. (It's likely Vixie Cron, and this basic feature is likely stable across versions of that program.) –  Kaz Jan 11 '13 at 0:11

To confirm John's answer, */n in the minutes column means "when the minute is 0 mod n". Here is a crontab entry:

*/7 * * * *  date >> /tmp/foo

and here's the output:

Thu Jan 10 14:49:01 GMT 2013
Thu Jan 10 14:56:01 GMT 2013
Thu Jan 10 15:07:01 GMT 2013

Note the gap between the last two times is not seven minutes, because after nn:56 the next time */7 matches is `nn+1:07.

Yes, I'm aware those times are in the future (or they were when I posted this); I had to drive the system clock forward rather fast to get a quick answer.

share|improve this answer
5  
+1 for the effort :) –  SvW Jan 10 '13 at 14:40

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.