Reboot web page for Pi with another Pi?

Does anyone have a simple way to reboot the Pi using a simple webpage with a reboot button?

I have osmc installed on a pi2 that is on 24/7 and re-purposed my old Pi1 for other projects such as mysql for kodi including other things which is also on 24/7.

My TV has a web browser and I would like to be able to go to a simple webpage click a button and it would reboot my Pi2 with OSMC. The idea is it would launch a script that would reboot the Pi2 via ssh or some other way.

I have tried using the kodi build-in web server but it does not have a reboot option, I tried other themes such as Arch but the reboot option still does not work. It maybe simple enough to just build a web server with a reboot option but not sure where to start.

The reason for this is because my Pi at times has frozen do to an addon, it will eventually come back to life but takes a while and not everyone in the house will go via ssh to reboot.

The buildin webserver (API) has a reboot option. It might not be shown on the webfront end but you can call it via HTTP JSON request
http://kodi.wiki/view/JSON-RPC_API/v6#System.Reboot

Forcing a reboot is only a workaround, suggest to find out why the addon freezes

What about having them use a free app, like Yatse, which can easily trigger a reboot?

I’ll have to look into HTTP JSON as to how it works, any pointers?

Can’t use Yatse as even that is to much effort since you would have to look for a mobile device, it just seems easier to go to the tv browser and force the reboot.

I just tried Arch on a second osmc pi that is in the bedroom and oddly enough Arch worked perfectly with the shutdown option, but not sure why it isn’t working with the Pi i actually want to use this on.

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

Not sure what you mean with this? What is working on Arch that is not on OSMC?

Arch is a web interface, not to be confused with Arch Linux. It has a built in remote which lets me reboot from a web browser. If it worked with with the Pi i need to reboot i would wouldn’t need to invest my time in HTTP JSON

http://kodi.wiki/view/Add-on:Arch

As fzinken suggested, how about getting rid of the add-on that’s causing the problem. If it’s causing periodic hangs, then it’s not a good thing and may cause you more headaches in the future.

If it where that easy, the addon is used to watch foreign non English content for my parents. The content is available on youtube but with Kodi it makes it seamless and easier to use.

Contact the developer of the add-on and see if they can’t work out the problem. As has been mentioned before in other threads, badly behaving add-ons cause problems.

As another thought, if the add-on is hanging Kodi, then you probably won’t be able to reboot it from the Kodi web interface (or json) anyways. You’d probably have to install a separate web server to do this.

Some good suggestions here, I especially like the one about contacting the add-on dev to fix the issue. But if you must reboot, I would think the quickest way would be to download the keymap editor add-on and either reprogram a button on your remote, or set an unused one to trigger a reset/reboot. Then it’s only one click away.

I don’t think that even adding a remote key for reboot would work, as Kodi is hanging. Once Kodi is hung there isn’t much you can do unless you SSH in. Maybe adding apache with a simple page to trigger a systemctl restart mediacenter would work.

Well I was able to get the Arch web interface to finally load by adding the three line to the advancedsettings.xml file found here.

I just want to try it out to see if it works when it hangs, I will see how it goes when it hangs and will also contact the dev to fix the addon. When it has hung before it has always come back without crashing or rebooting but can take a few minutes, however forcing it to reboot over SSH has always worked, so it’s not like it’s totally unresponsive.

My original idea was to setup a small webpage on my Pi1 with a single button that once clicked launches a script that logs in via SSH on the OSMC Pi and sends the reboot command, which will then force a reboot just as I would have done manually. But as of now I really have no idea where to even begin.

SSH will normally work even if Kodi is hung, because Kodi is just a program running, it’s not the OS. If Kodi is hung, using things (like the Kodi web interface) may not work.

If you want do a remote restart of Kodi, instead of rebooting you can ssh in, and

sudo systemctl restart mediacenter

That will restart Kodi without a reboot.

If SSH doesn’t work, then you have a much more serious problem.

sudo systemctl restart mediacenter indeed works. I was able to start a remote ssh connection from the pi1 I just can’t get it to enter the command via script automatically, still have to manually enter it in.