#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. for gpio in 4 17 18 21 22 23; do echo $gpio > /sys/class/gpio/export echo out > /sys/class/gpio/gpio$gpio/direction chown www-data /sys/class/gpio/gpio$gpio/value done # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi MAX_TRIES=20 if ! ifconfig eth0 && ifconfig wlan0 ; then sleep 6 while ((MAX_TRIES-- > 0)) && ! /sbin/wpa_cli status | grep -q wpa_state=COMPLETED; do /sbin/wpa_cli status ifdown wlan0 ifup wlan0 done fi su realraum -s /bin/sh -c "sleep 10 && /home/realraum/play-sound-status.py /home/realraum/play-sound-status.cfg &>/dev/null &" & exit 0