From: Nicolas Boisselier Date: Sun, 16 Aug 2015 16:28:22 +0000 (+0100) Subject: shairplay X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=aa45aa18c881ff661d1e6c5dfef0d6a0b02d8fca;p=nb.git shairplay --- diff --git a/etc/init.d/shairplay b/etc/init.d/shairplay new file mode 100755 index 00000000..58a43761 --- /dev/null +++ b/etc/init.d/shairplay @@ -0,0 +1,68 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: /etc/init.d/shairplay +# Required-Start: $local_fs $remote_fs +# Required-Stop: $remote_fs +# Default-Start: 2 3 5 +# Default-Stop: 0 1 6 +# Author: Nicolas Boisselier nicolas.boisselier@gmail.com +# Short-Description: /etc/init.d/shairplay +# Description: NB 16.08.15 - (C) 2015 Nicolas Boisselier +### END INIT INFO + + +PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin + +DAEMON=/usr/bin/shairplay +ARGS="" + +NAME=`basename $DAEMON` +PIDFILE="/var/run/$NAME.pid" + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +# Source defaults file; edit that file to configure this script. +START="yes" +PORT="" +PASSWORD="" +APNAME="" +if test -e /etc/default/$NAME ; then + . /etc/default/$NAME +fi +if [ "$START" != "yes" ]; then + echo "$NAME not configured to start, please edit /etc/default/$NAME to enable (START=yes)" +fi +[ -n "$PORT" ] && ARGS="$ARGS --server_port $PORT" +[ -n "$PASSWORD" ] && ARGS="$ARGS --password $PASSWORD" +[ -n "$APNAME" ] && ARGS="$ARGS --apname $APNAME" + +case "$1" in + start) + log_daemon_msg "Starting" "${NAME}" + start-stop-daemon --start --background --quiet \ + --pidfile $PIDFILE --make-pidfile \ + --exec $DAEMON -- $ARGS + log_end_msg $? + ;; + stop) + log_daemon_msg "Stopping" "${NAME}" + start-stop-daemon --stop --quiet --retry=USR2/30/KILL/5 --pidfile $PIDFILE --name $NAME + log_end_msg $? + ;; + force-reload|restart) + $0 stop + $0 start + ;; + status) + status_of_proc -p $PIDFILE $DAEMON ${NAME} && exit 0 || exit $? + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload|status}" + exit 1 + ;; +esac + +exit 0 +