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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I suspect (edit: I’m pretty sure by now) that it doesn’t do what you want: fields are separate, and
*/45for minutes is nothing more than0,45. I would use the following three entries if*/45doesn’t do the job:If you take a look at
entry.cfile in vixie cron sources, you’ll notice that each field of each entry is parsed byget_listand represented as bitmaps of allowed values for that field. That almost precludes any “smart” interpretation, as the distinction of*/45and0,45is lost at this stage… but there is aMIN_STARflag, set at the presence of*in minutes (including*/45). So we take a look atcron.c, a single place whereMIN_STARis examined, to learn it’s unrelated to our problem. Now we know for sure that*/45means “every 45th minute of every hour“: 0:00, 0:45, 1:00, 1:45 and so on.There were two answers here confidently stating the opposite, quoting an unfortunate passage in the manual:
We are lucky to have a 24 hour day, containing even number of hours, making “every two hours from 0:00, each day” and “every two hours generally” indistinguishable. Too bad that the manual didn’t go far enough to document non-trivial cases, making the impression that
* */22means every 22 hours. It does not. Star with a step is just a shorthand for a list of values in the field where it’s used; it doesn’t interact with other fields.