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.

Possible Duplicate:
How does cron handle remainders in “every so often” jobs

Am willing to run a script every 45 minute (not the :45th minute of every hour)

e.g. 10:00, 10:45, 11:30, 12:15, and so on.

*/45 * * * *

Am not sure this is the correct expression.

share|improve this question

marked as duplicate by MadHatter, growse, Dave M, Alex, voretaq7 Jan 25 '13 at 16:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

3 Answers

Check wiki.

My understanding is that this will be every 45th minute of the hour. (e.g. 10:45).

So */15 would run at 10:00, 10:15, 10:30, 10:45, but */45 will only run at 10:45.

Important difference: */n = nth minute not every n minutes.

share|improve this answer
    
A very important concept here is to note that */15 will run at 10:00, 10:15, 10:30, 10:45, etc.. –  Andrew M. Jan 25 '13 at 8:23
    
Well spotted, will edit my answer. –  LuckySpoon Jan 25 '13 at 9:21
    
Which presumably also means that */45 will run at 10:00 and 10:45. –  MadHatter Jan 25 '13 at 10:43
add comment

No, this means that you will run a command on minutes that are evenly divisible by 45. I.e., 12:45, 1:45, 2:45, etc.. If you want to run the command every 45 minutes, you have two options. First, you should have your script have some knowledge of when it's running and just have cron run */15 minutes and check to see if it's a 45 minute interval from what it expects. The second option is a lot more annoying to configure:

0,45 0,3,6,9,12,15,18,21  * * *
30   1,4,7,10,13,16,19,22 * * *
15   2,5,8,11,14,17,20,23 * * *
share|improve this answer
add comment

No, this will only run the script once at 45 minutes past each hour as the interval is reset (in this case) every 60 minutes. You could use something like

*/15 * * * * ...

and have your script figure out if it should run or not.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.