I'm using this in as my /etc/init.d/pirateRadio.sh
the Radio does play a wav with this in the rc.local
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/bin
sleep 10
(
exec &>> /var/log/my_rc_local.log
cd /home/pi/pifm/pifm && ./pifm left_right.wav 100.1 stereo
) &
I had the led working before I added the above by itself in the rc.local
# Light ON AIR LED
sudo python /home/pi/pifm/pifm/ledon.py &
but now I am trying to combine both, in a shell and i am lost.
I usually get [src/libout123/wav.c:755] error: flushing failed: Broken pipe
This is what I have craeted for pirateRadio.sh
#!/bin/bash
# /etc/init.d/pirateRadio.sh
### BEGIN INIT INFO
# Provides: pirateRadio.sh
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Runs radio
# Description: Runs my radio.
### END INIT INFO
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/bin
sleep 20
# This works in the rc.local
# (
# exec &>> /var/log/my_rc_local.log
# cd /home/pi/pifm/pifm && ./pifm - 100.1
# ) &
###
case "$1" in
start)
echo "StARRRRRRRting Pirate Radio"
sudo /usr/bin/mpg123 -4 -s -Z /home/pi/Music/* | cd /home/pifm/pifm/ && sudo ./pifm - 100.1
;;
stop)
echo "Stopping Pirate Radio"
killall pifm
;;
*)
echo "Usage: /etc/init.d/pirateRadio.sh start|stop"
exit 1
;;
esac
# Light ON AIR LED
sudo python /home/pi/pifm/pifm/ledon.py &
exit 0
Oh and additionally, if I correct, "esac" to "case" I get
sudo ./pirateRadio.sh start
./pirateRadio.sh: line 37: syntax error near unexpected token `newline'
./pirateRadio.sh: line 37: `case '