Stopping the openhab2 service wipes all things out


When I stop the openhab2 service, sometimes the length of then items json storage file will be zero. All items are lost. It happens 5-6 times from 10 restarts. File system is clear, I’ve checked it.
This is very annoying, because I have 100+ items in the database…
I know that the file can be restored from the backup directory, but I think this is not the expected behavior at stopping the service…
Openhabian OH 2.4 with the latest patches…

What could be the problem?

How are you stopping the service?

With the command: sudo service openhab2 stop. On RPi 3+ it takes 30-60 secs to finish the shutdown.

You could try to create an override for the oh service and increase the TimeoutStopSec value, maybe that helps.

Do you mean, that the service stop process takes too long and ruins the database?

Just guessing here, but I think the service will be killed after 60 seconds, so it’s a possibility.

weakfl: you are right!! I’ve increased the stop waiting time, and voila: it works now!

Thanks for the help! :slight_smile: