Skip to content

Instantly share code, notes, and snippets.

@naphthalene
Created July 12, 2015 20:12
Show Gist options
  • Save naphthalene/fd3f2a0c863a432ae776 to your computer and use it in GitHub Desktop.
Save naphthalene/fd3f2a0c863a432ae776 to your computer and use it in GitHub Desktop.
MPD FM Radio Init Script
#!/bin/bash
### BEGIN INIT INFO
# Provides: mpdfifo
# Required-Start: pulseaudio mpd
# Default-Start: 2 3 4 5
# Short-Description: MPD FM radio broadcasting
### END INIT INFO
# Author: Pavel Sadikov <pashalab@gmail.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="MPD Radio"
NAME=mpdfifo
SCRIPTNAME=/etc/init.d/$NAME
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
do_start()
{
/home/pi/pifm/pifm /tmp/mpd.fifo 88.0 44100 mono &
}
case "$1" in
start)
log_daemon_msg "Setting up radio: $NAME"
do_start
log_end_msg $?
;;
*)
echo "Usage: $SCRIPTNAME {start}" >&2
exit 3
;;
esac
:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment