I have installed OSMC and have been running it for some weeks now. Unfortunately it freezes in the screensaver after not being used for a long time. Since I have monit installed, I thought to monitor kodi, but that is not as easy as it sounds.
First of all, kodi is started without a pid file and I cannot seem to find the startup commands to alter it to generate a pid file. Second I want to be able to do a check that it actually works. So I thought maybe there is an easy json api that I can call to see if the process is still running, but the only thing there is is the jsonrpc api which always needs an url enoded request with some json parameters.
Is there not a simpler way to monitor Kodi, so I would be able to use monit to restart it when it freezes?
I assume that it would be a preferable solution to fix the freezing instead of working around it.
After you reboot, have you tried looking at the .old Kodi log file? This is the log from the session before you rebooted. It might have information about why Kodi is freezing.
Of course I want to solve that problem, but as we all know sometimes hardware or software fails. So when I have monit checking if kodi is still running and accepting commands, I can make sure it is still running and otherwise do a simple restart.
It is a failsafe mechanism, so my wife and kids can use the mediaplayer without having to call for me to help them out (and then ssh to the machine and do a service restart…)
Theoretically there already is a script that restarts kodi if it is killed but that doesn’t apply here as it only seems to hang…
You could do a script that sends a xbmc-send command to check if kodi accepts input and grep for an error message. Then restart it if it isn’t responding.