Cron based rules still executing at old time in spite of changes

Tags: #<Tag:0x00007fc8f410d848>

RPi3 OH 2.3 I changed the execution time of a rule and have found that it still executes at the previous time. It also runs at the new time, but can’t figure out why. Here is the current rule:

rule "Turn off Desk Light everynight at midnight"
   Time cron "0 0 0 1/1 * ? *"

The old rule was:

rule "Turn off Desk Light everynight at 11pm"
    Time cron "0 0 23 1/1 * ? *"

I had another cron based rule which executed at 4pm during the Mon-Fri, that I have since removed, but the rule continues to execute.
What give? How do I troubleshoot this?

Did you reboot since changing the rules?
If that doesn’t work have you tried clearing the cache?

Yes, I’ve rebooted several times since I noticed this happening and I’ve seen the post you list here, as well. I’ve been trying to figure this out for about a month now. Unfortunately, there is no command in the karaf console that lets you list rules like you can with Items and Things.

As you’re usig a RPi you might have SD card corruption.
Can you clone your card to a new one and try again?

Thanks, but I’ve tried that as well. I name regular backups and swap out the SD card when I do that.

If you remove the Rule does it not fire or does it continue to fire at the old time?

Do you have any other version of the .rules file in your rules folder? Perhaps an automatically created backup by the editor you are using? Use ls -la in the rules folder and make sure there isn’t a hidden file with the old version of the Rule still in the folder.

In openhab.log do you see the file this Rule is written in being loaded twice?

OH doesn’t cache Rules from one startup to the next so when you rebooted OH it completely clears out the Rules and recreates them based on the .rules file. So the only thing that makes sense to me is you have a file in there somewhere that has the old version of the Rule still in it.

Of course, a corrupted file system could be a problem as well as Mihai suggests.

Nope, no hidden files. When I edit the rule, I only see this in the log:

2018-08-15 07:55:52.768 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model    'desk_light.rules'
2018-08-15 07:55:57.956 [INFO ] [org.quartz.core.QuartzScheduler     ] - Scheduler openHAB-   job-scheduler_$_NON_CLUSTERED started.

I’ll spend the weekend rebuilding my setup using a fresh SD card and see if the file system is somehow corrupted.

Thanks for the reply.