Skip to content

Instantly share code, notes, and snippets.

@nikolaiwarner
Last active August 29, 2015 14:00
Show Gist options
  • Save nikolaiwarner/11214792 to your computer and use it in GitHub Desktop.
Save nikolaiwarner/11214792 to your computer and use it in GitHub Desktop.
#!/bin/sh
### BEGIN INIT INFO
# Provides: shairplay
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Shairplay
# Description: Shairplay: Apple airplay and raop protocol server
### END INIT INFO
PATH=/sbin/:/ust/local/bin/
DESC="Shairplay service"
NAME=shairplay
DAEMON="/usr/local/bin/shairplay"
DAEMON_ARGS="-a SpaceJamz"
DEPLOY_DIR="/etc/shairplay"
PID=/var/run/${NAME}.pid
[ -x "$DAEMON" ] || exit 0
. /lib/lsb/init-functions
start() {
start-stop-daemon --start --quiet --pidfile $PID \
--make-pidfile --background --chdir $DEPLOY_DIR \
--retry 5 --exec $DAEMON --oknodo -- $DAEMON_ARGS
}
stop() {
start-stop-daemon --stop --quiet --pidfile $PID \
--retry 5 --oknodo --exec $DAEMON
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
stop
log_end_msg $?
;;
status)
status_of_proc -p $PID "$CMD" shairplay
;;
*)
echo "Usage: $0 <start|stop|status>" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment