I suspect (I’m editing now: I’m sure) that he doesn’t do what you want: the fields are separate, and */45 for minutes is no more than 0,45 . I would use the following three entries if */45 not doing the job:
0,45 0-23/3 * * * 30 1-23/3 * * * 15 2-23/3 * * *
If you look at the entry.c file in vixie cron sources, you will notice that each field of each record is analyzed by get_list and presented as bitmap images of valid values for this field. This almost eliminates any “smart” interpretation, since at this stage the difference between */45 and 0,45 is lost ... but there is a MIN_STAR flag set in the presence of * in minutes (including */45 ). So, take a look at cron.c , one place where MIN_STAR being MIN_STAR to find out that this is not related to our problem. Now we know for sure that */45 means "every 45 minutes of every hour": 0:00, 0:45, 1:00, 1:45, etc.
There were two answers that confidently stated the opposite, citing an unsuccessful passage in the manual:
The steps are also allowed after the asterisk, so if you want to say "every two hours" just use "* / 2"
We are fortunate that we have a 24-hour day containing an even number of hours, making "every two hours from 0:00 every day" and "every two hours in general" indistinguishable. It is unfortunate that management did not go far enough to document non-trivial cases, giving the impression that * */22 means every 22 hours. Is not. A star with a step is simply a reduction of the list of values in the field where it was used; It does not interact with other fields.
Anton Kovalenko Jan 25 '13 at 8:28 2013-01-25 08:28
source share