Cronjob every 2 hours - Invalid cron field '/2' for field [HOUR]

Hi,

I try to get a task running every 2 hours. This is my cron setting: 0 0 /2 * * *

Saving throws an error: Invalid cron field ‘/2’ for field [HOUR]

Bug??

Version is latest 10.23

Best Michi

Needs to be */2:

0 0 */2 * * *

Oh man, my Bad. All cron Tools returned me 5 Elements instead of 6 and i read the * as separate element. Time to call it a day. Thanks.

To explain my mistake:

Preside is working with 6 digits cron. The 6 fields have the following meaning:

┌───────────── Second (0 - 59)
| ┌───────────── Minute (0 - 59)
| │ ┌───────────── Hour (0 - 23)
| │ │ ┌───────────── Day of month (1 - 31)
| │ │ │ ┌───────────── Month (1 - 12)
| │ │ │ │ ┌───────────── Day of week (0 - 6)
| │ │ │ │ │
* * * * * *

In my case I wanted to run the task every two hours.

The right setting is as @seb said: * * */2 * * *

If I wanted to start the task at 4 AM, the setting would be * * 4/2 * * *

Cron settings can be very difficult and disturbing, if things are getting complex.

A very good page I found: Free Online Cron Expression Generator and Describer - FreeFormatter.com
There are also a bunch of examples with not so common settings, like “Every month on the last Sunday, at noon” (which is 0 0 12 1L * ?)

Actually, you should check the translated text for * * */2 * * *. I believe that will run every second and every minute every 2 hours…

So this may be more appropriate: 3 23 */2 * * * (at 23 minutes and 3 seconds past the hour, every two hours, or use some other random time to have your tasks spread). Or just 0 0 */2 * * * (every two hours)

@m.hnat

While I think you’re absolutely right (and I will change it), the task manager says something different:

image

So I don’t know if the cron is wrong or the execution.

We’re using java cron libs to calculate these so I’d be surprised if wrong. It could be a case that this logic only kicks in for certain cron combinations (I’ve seen it happen and got a surprise)