Shutdown scripts for XBian


Default SSH user name is xbian, password raspberry

  • Key in :
    cd /etc
    sudo nano rc.local
  • Copy and paste the following into the nano editor window, just above the last line (before the line exit 0)
    (/etc/irswitch.sh)&
  • Press ctrl+x to exit the editor, y to confirm, enter to save the file
  • Key in
    sudo nano irswitch.sh
  • Copy and paste the following text into the editor window
    #!/bin/bash
    # this is the GPIO pin receiving the shut-down signal
    GPIOpin1=14
    echo "$GPIOpin1" > /sys/class/gpio/export
    echo "in" > /sys/class/gpio/gpio$GPIOpin1/direction
    while true; do
      sleep 1
      power=$(cat /sys/class/gpio/gpio$GPIOpin1/value)
      if [ $power != 0 ]; then
        echo "out" > /sys/class/gpio/gpio$GPIOpin1/direction
        echo "1" > /sys/class/gpio/gpio$GPIOpin1/value
        sleep 3
        sudo shutdown -h now
      fi
    done
  • Press ctrl+x to exit, y to confirm, enter to save the file
  • Key in
    sudo chmod +x irswitch.sh
    sudo reboot
  • After reboot you can use the RemotePi Board to power cycle XBian

The above script has been tested and is confirmed to work up to XBian 2016.05.12. Although not yet tested, it most probably will work with newer versions as well.

This page was last updated 18-Apr-2018