Auto reboot of combined homegear/openhab image after powercut


#1

I have homegear 0.5.24 & openhab running on a RPi with COC using the combined pre-built image.
Due to where I live I experience frequent powercuts.

If I manually stop a working RPi by issueing a ‘shutdown –h 0’ command or even a ‘reboot’ command it will bootup ok and the RPi & COC will come online ok, and homegear & openhab will start up as normaI.

However after a powercut (i.e. a non-graceful closedown) the COC does not come back on line (easily determined by its non-flashing LED – only flashes when ok – and of course no radio link to devices). The RPi and homegear start-up ok and I get the login prompt as expected but the COC seemingly fails to initialize. If I subsequently issue a shutdown or a reboot command the full system (including COC) ALWAYS comes back ok.

It therefore appears that the lack of a graceful closedown process (in a powercut situation) is preventing the COC from coming back on line, and it will only do so after manual intervention by a manual graceful close and restart, which appears to sort out the problem.

While I appreciate that by design a unix based system is always designed to be gracefully closed, unfortunately I cannot control the power cut situation. However since I can ALWAYS restore the COC operation with a subsequent gaceful closure and restart, I was hoping that it would be possible to add whatever tidyup is done during the close process to the startup process so that the unit will achieve a full working autoboot even after a powercut.

I would appreciate any help and perhaps a change to the combined pre-built image to achieve auto re-boot during a power cut situation.

Regards,
Keith


#2

Hey Keith,

I have to check if I can reproduce the problem here - it is interesting as I don’t see the difference for the COC. As a workaround you can create a file on startup (e. g. in an init script) which you delete on a graceful shutdown. If it exists on startup then you automatically reboot.

Cheers,

Sathya