Apologies in advance for both semi-hijacking as well as necrobumping this issue, but I think there is validity to the request being made here.
It seems to me that people are talking past each other a little bit, so let me try to recap the situation.
The problem: openHAB, the OS or the machine on which it runs can all become unresponsive for a variety of reasons. The cause of this (bad hardware, insufficient power supply, solar flares, bad karma, software bugs or any number of other things) isn’t really that interesting when you want service restored as quickly as possible. If things aren’t running, automation becomes quite tricky.
Now, there are some mechanisms that will help with at least some of this. As an example, if the hardware has a hardware watchdog (which is what OP is talking about), watchdog software on the machine can be told to configure that hardware and ping it (think heartbeat, not ICMP ping) on a regular schedule. If the deadline is missed, the hardware will trigger a reboot of the machine, so even a dead OS will can be brought back to life. systemd will do this on Linux distributions using it with a single line in /etc/systemd/system.conf. There is also other watchdog software for systems not using systemd.
The linux kernel can be told to reboot on kernel panic.
systemd takes it further with programs adapted for it, where systemd will expect the application to send a heardbeat every X seconds and if it isn’t either the application is restarted or the machine itself. The action is configurable.
Unresponsive can of course mean a lot of things and what I describe above is obviously only a small part of it, but some cases can be dealt with when all you care about is “get it back up and running”.
I am also of course not advocating not looking into why it required a restart in the first place but if I’m not physically in front of the device, I would much prefer a forced reboot and restoring the service and then looking into why it crashed later rather than have no automation at all.
The hardware thing has nothing to do with openHAB as such. Anyone on a machine with a hardware watchdog and an OS that supports it can go right ahead and enable it.
For the service watchdog, that will require cooperation by openHAB where it needs to use the sd_notify
call (or equivalent) to signal its status to say both “now I’m ready” and “I’m still alive” and this would be very neat if we could do that in openHAB.