Help understand "cron" timings

I have a rule that I copy/pasted from somewhere else on the forums and it runs hourly.

Time cron “0 0 * * * ?” or // Every Hour

Can someone help me understand how this works? From my reading on the web I’d be expecting this rule to only run once per day at midnight… But it does seem to run every hour…

Yup, that’s hourly. Seconds, minutes hours… So at 0 seconds, 0 minutes every * hour.

“0 0 0 * * * ?” would be midnight every day.

Cron tutorial here: http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/tutorial-lesson-06
Docs related to cron triggers: https://docs.openhab.org/configuration/rules-dsl.html#time-based-triggers

Edit… Most linux crontab stuff doesn’t use seconds so that’s probably what is throwing you off. Use the quartz docs for reference instead.

1 Like

openHAB makes use of Quartz Cron, which is slightly different from common cron in GNU/Linux.

The biggest difference (that I’m aware of…) is, that quartz cron has the ability to trigger per Second, while GNU/Linux cron will only trigger per Minute.

Hi,
there is a crontab generator online that use Quartz instead of Crontab: http://www.cronmaker.com/ that can be useful for openhab schedules.

1 Like

Thanks guys, that makes more sense!