Why did my cron job run this month?

Solution 1:

The / is not an arithmetic expression, instead it describes "step values" over the allowed range of values. So, since months always start with 1 instead of 0, /2 would mean "take every other value", resulting in (1, 3, 5, 7, 9, 11).

This is also decribed in the manual page, although this is not terrible clear and easy to understand:

Step values can be used in conjunction with ranges. Following a range with "<number>" specifies skips of the number’s value through the range. For example, "0-23/2" can be used in the hours field to specify command execution every other hour (the alternative in the V7 standard is "0,2,4,6,8,10,12,14,16,18,20,22"). Steps are also permitted after an asterisk, so if you want to say "every two hours", just use "*/2".

Solution 2:

Today is the first day in November.

*/2 means that your cronjob will execute every other month as you say.

So next month (December) the cronjob will not be executed, but the month (January) after it will be.

The month before this month (October) the cronjob was not executed. But in September it was.

Tags:

Cron