[SOLVED] Problem with presistence and cron syntax

I want to write presistence values to rrd4j every 5 minutes.

Settings:
Strategies {
everyMinute : “0 * * * * ?”
every5Minutes : “0 0/5 * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”

This one is working:
Temperatur : strategy = everyMinute

I tried this one, but it does not write anything
Temperatur : strategy = every5Minutes

If I use “0 0/5 * * * ?” in a rule it is working as expected, does something every five minutes.

What is going wrong? Is the cron syntax different in rules and presistence?

shouldn’t this be (not sure):

every5Minutes : "0 */5 * * * ?"

In the cron documentation it is written, that this should work.
http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger
This cron syntax x/y tells to run starting at x every y.

I’ve tested it with a rule and the rule was triggered every 5 min starting at minute 0.

I can use every5Minutes : “0 5,15,25,35,45,55 * * * ?” should work, I will check this

your suggestion every5Minutes : “0 */5 * * * ?” has the same syntax that my original one, but I will test it too

I guess you won’t be happy with that, see the docs:

http://docs.openhab.org/addons/persistence/rrd4j/readme.html

All item- and event-related configuration is done in the file persistence/rrd4j.persist. The strategy everyMinute must be used, otherwise no data will be persisted (stored).

2 Likes

ok, now it is clear, that only this will work, thanks.

Also as a small side note: Depending on your goal you might want to hop on to a more powerful persistence solution right from the beginning. See here as an example:

wow, cool, I will test it.

Depending on your goals, a two vendor strategy could be interesting…

MapDB for switches and binary sensors,
Influx dB for values.

Tell us your goals…

This is exactly what I want to do. store presistence in mapdb, store charts in rrd4j or Influx dB