Webserver OS Commands to recover crashed App

Hi All.
So I have had a good 6 months of Pi OSMC experience with a couple of Audio dropouts on MP3s, but otherwise solid performance.
Over the last month or so things have changed and there have been regular lockups. On the last one I jumped onto the Pi via SSH and the OS was still up and running
Having seen some of the other threads of people who had hangs I tried an application restart
sudo systemctl restart mediacenter
It worked (Woohoo)
Now I am expecting the issue has come up due to something that patched, and with many people experiencing it, I am assuming that it will get sorted sooner or later.
My thoughts are in the mean time add an other page to the existing webserver, and have it kick off a server side command (As above)
I have two issues with this

  1. Where the Eff is the docroot for the webserver on it (You know the one that the remote control app sits on)
  2. What languages/OS hooks are available (Or do I have to shoehorn something like PHP onto it that I can fire OS command from

Is the webserver still responsive if kodi crashes?
Also, a command to kodi wouldn’t work. You would need to do a system command with sudo systemctl restart mediacenter.
I think you can imagine what this means in terms of security…

Would it be that much more convenient to push a button on a website than sshing in and issue the kodi restart command?

Hi mcobit thanks for the quick response.
The Webserver is still serving content when OSMC has crashed, but because OSMC has crashed there is nothing responding to the calls.
In terms of security… This little baby is behind my firewalls I am happy to open it up. And allowing that in the case of webs services, I can limit the calls to controls of my selection I am good with that :slight_smile:
As for the pushing the button thing…
Yeah it is a little more convenient to me… But a LOT More convenient to my wife who though a geek herself want’s stuff to just work.
So from the “Customer experience” perspective, the easier I can make it the more buyin I get for Projects :smiley:

You would need php with deactivated safe mode on the server side and use a simple call to a script with the shell_exec() function that restarts the mediacenter. Not sure if the kodi webserver even utilises php. it has a built in json interpreter that most likely will not work anymore when it crashes.

As an alternative: Some ssh clients have the option to program a custom command on login.

So in short my best bet is to add a second webserver on a different port and add php or the server side interpreter of my choice?

I think this might be the best option.
Of course you can also use nodejs or something.

You are mis-understanding something here. OSMC is the operating system. If OSMC crashes, you would not be able to SSH in. It’s the application Kodi that is hanging.

Just want to clarify the terminology.

I was under the impression that Kodi is the Media Center Software.
Rasbian is the OS.
And If we are being technical OSMC is the distribution.

OSMC is not based on Raspbian

The web server in Kodi is libmicrohttpd based, but it can serve static files. There is a JSON-RPC API which is better suited for your needs and should allow you to restart Kodi if not completely frozen.

I thought I read it was a debian…
So how/where do I put content to execute against (See my first question re docroot) the libmicrohttpd instance, (Or are there any manuals you can direct me towards?)

Yes – it’s based on Debian Jessie.

See http://kodi.wiki/view/JSON-RPC_API.