Rule stopped executing

  • Platform information:
    • Hardware: Beaglebone
    • OS: Ubuntu
    • Java Runtime Environment: java version "1.8.0_77"
      Java™ SE Runtime Environment (build 1.8.0_77-b03)
      Java HotSpot™ Client VM (build 25.77-b03, mixed mode)
    • openHAB version: 2.0.0 (How do I check the version)
  • Issue of the topic: I’ve a cron job that’s stopped working
    I’m using monit to verify that my openhab system is all nice and happy, and getting it to reboot if it’s been down for 15 minutes.
    In order to verify that all’s good, I’ve a simple rule that runs: “Watchdog” that prints a line in the config every 10 minutes, so monit see’s some activity.

However, recently it’s stopped working :frowning:

And I just discovered why :slight_smile: - it always helps to re-read configuration files:

The Rule in question:

rule "Watchdog"
Time cron "0 0/10 * * * ?"
logInfo(“watchdog.rules”, “Still running”)

However, I’d copied this to a new rule (and changed the guts, but accidentally left the rule name the same.
This caused 2 rules to load with the same name (from different files), and so I’m guessing only the second one gets executed (At least I can verify the second one was getting executed).

Can I request that some warning gets put into the logs if there is a clash? e.g. “[WARN] - overwriting rule definition”

Hopefully this stops someone else making the same mistake

Sort of off topic. Do you have any more info you can share about your monit setup? I currently use a second OH instance to do something similar but restarting a service from a remote box isn’t easy to setup and I haven’t taken the time to get that working so it simply texts me and I do it manually.


I do recommend upgrading your JRE to at least 1.8.0_115.

You can look in /var/lib/openhab2/etc/ It will show the version. If you have a more recent version it will show the version at the bottom of the Dashboard at http://ohserver:8080. Or, when you first start OH it prints the version to the log early on. Or you can log into the karaf console and it will print the version after logging in.

I’ll second Moxified’s request. A tutorial would be awesome. If you do, please post it in the Tutorials and Examples section so people can find it.

It’s no big deal in this case, but rules and logs are a lot easier to read if you use code fences.

code goes here

Indeed, rules must have a unique name.

I’m pretty sure it does in newer versions of OH, (2.1 and 2.2 SNAPSHOT).

1 Like