Shutdown remote system with menu->shutdown
#1
Hi,

i have a kodibuntu and a raspberry pi for a hyperion ambilight. Currently i'll have to ssh into the raspberry to shut it down. While this is not a problem for me, my wife needs an easier option. So what i want to achieve is that if she is selecting menu -> shutdown from within kodi, it should run a script which logs into the raspberry and runs a shutdown command.

Question:
Is there an option to modify XBMC.ShutDown() in a way that it runs a script, or is it better to just provide a script in /etc/init.d and link it to /etc/rcx.d ?

Thanks,

nailz
Reply
#2
Here is what i did:

on kodibuntu as root:

Code:
ssh-keygen
ssh-copy-id root@raspberrypi
vi /etc/init.d/raspberry

and insert the following code (replace reptile.universe.lan with your pi or remote server):
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: raspberry
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: stop and reboot ambilight-raspberry
# Description: This file stops raspberry and its ambilight
#
### END INIT INFO

case "$1" in
start)
   ;;
stop)
   ssh [email protected] '/sbin/shutdown -h now'
   sleep 10
   ;;
restart)
   ssh [email protected] '/sbin/reboot'
   sleep 10
   ;;
*)
   echo "Usage: raspberry {start|stop|restart}" >&2
   exit 3
   ;;
esac

make the script executable and link it in runlevels:
Code:
chmod +x /etc/init.d/raspberry
ln -s /etc/init.d/raspberry /etc/rc0.d/K99raspberry
ln -s /etc/init.d/raspberry /etc/rc6.d/K99raspberry
Reply

Logout Mark Read Team Forum Stats Members Help
Shutdown remote system with menu->shutdown0