Skip to content

Instantly share code, notes, and snippets.

@kenci
Last active October 17, 2015 21:26
Show Gist options
  • Save kenci/23e5245f141693f8439d to your computer and use it in GitHub Desktop.
Save kenci/23e5245f141693f8439d to your computer and use it in GitHub Desktop.
Hyperion remote start/stop
#!/bin/sh
test -f /usr/bin/hyperiond || exit 0
case $1 in
start)
curl -s -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Hyperion","message":"Enabled","image":"/home/osmc/scripts/hyperion.png"}}' http://127.0.0.1/jsonrpc > /dev/null
sudo /usr/sbin/service hyperion start
;;
stop)
curl -s -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Hyperion","message":"Disabled","image":"/home/osmc/scripts/hyperion.png"}}' http://127.0.0.1/jsonrpc > /dev/null
sudo /usr/sbin/service hyperion stop
;;
restart)
curl -s -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Hyperion","message":"Restart","image":"/home/osmc/scripts/hyperion.png"}}' http://127.0.0.1/jsonrpc > /dev/null
sudo /usr/sbin/service hyperion restart
;;
*)
echo Usage: hyperion-control.sh start|stop|restart
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment