This question already has an answer here:
I have the cron job as shown below, and wanted it to run every 2 hours, but it keeps running every 2 minutes.
Can someone tell me where I'm going wrong?
* */2 * * * /path-to-script
|
This question already has an answer here: I have the cron job as shown below, and wanted it to run every 2 hours, but it keeps running every 2 minutes. Can someone tell me where I'm going wrong?
|
|||||
marked as duplicate by Michael Hampton♦ Sep 20 '14 at 14:59This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. |
|||||
|
|||||
|
An asterisk in the minute (first) field tells it to run every minute, regardless of the other fields. You need to specify an exact minute to run within the hour. Be that on the hour (0), half past (30), etc..
|
|||||||||
|
|
The correct description of what you had
is "run every minute where the hour is a multiple of 2". Which means 00:00 to 00:59, 02:00 to 02:59, 04:00 to 04:59, ... and so on. Not quite the same as "run every minute". The solution already given is valid though. |
|||
|
|
|
Off the top of my head, you could try specifying all the hours when it should run:
|
||||
|
Also you can do this:
or if you want to be more specific on every 2 hours, you can use:
The hours values should be separated by commas. |
||||
|
|