Just curious if there is a way to force an immediate save of the user_data, vs relying only on the 6 min after restart and then every 60 minute saves? Maybe via the http interface?
I’m interested because I’m trying to automate creation and recovery of openluup in a Docker container, and would like to save the user data immediately after restoring from backup (so I can then tear down the container).
So I need to find the right way to shutdown openLuup. The container I am running is supposed to send a sighup signal to all running processes. But when I shutdown the container the data hasn’t been saved. I think the container logic only gives a process .5 sec to terminate before it sends a sigkill. You’ve given me a path to explore. Thanks.
Here’s a twist. I haven’t been able to figure out how to cause openLuup to exit normally. Sending a sighup does cause shutdown but there’s no save of the user data. [[ I just saw your comment about lua and signals as I was finishing this post. I may try the ‘exit’ request - thanks for that ]]
So I tried the initiate a backup approach. The backup is created just as expected. But again there is no save of user data. I don’t know what I am doing wrong
This is what I execute in my initialization script, after starting openLuup with the backup file and waiting a short time for it to fully start and load
The backup file is created just fine. But the user data is unchanged
-rw-r--r-- 1 root root 11505 Jan 26 00:09 user_data.json
if it was updated it would be a few hundred k. Yes I know I shouldn’t be running as root.
But this gives me other ideas. I’ll just keep the original backup file around until startup confirms that the user data has been updated (> 100k). If not, just start with the backup like before. This way if the container ends before the normal save, just try again. No need to tear it all down and start from scratch. openLuup lives on a persistent volume by the way. The data plus any subsequent updates survives the ending of the container.
The version of the posix module that is included in the Vera firmware is OLD… So the current documentation doesn’t match the implementation (the Vera implementation is not modulized)…
User data is saved, like immediately and very inline with the initialization of the build. Which is what I was going for.[/quote]
Good, delighted to hear that!
On your earlier comment…
…the backup IS a save of user data. It happens also to be compressed using the LZAP algorithm and so ends up about 5 to 8 times smaller than a user_data.json file. However, it can be used directly as a parameter to the openLuup_reload script to run a saved configuration.
…well, you’re quite right, of course. What, perhaps, I should have said is that there’s no native way (or possibly os-independent) way of doing this.
A basic design requirement (in my mind) for openLuup was that it should be platform independent. It does, quite happily, run under Windows. The posix library, of course, does not do this (or, at least, I don’t think so?)
There ARE people who run openLuup on Windows, but I have to admit that the vast majority are on unix/Linux/Posix-like systems.
So thanks for the correction.
Best Home Automation shopping experience. Shop at Ezlo!