--- /dev/null
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: piplayer
+# Required-Start:
+# Required-Stop:
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: init-Script for piplayer
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=piplayer
+CONF=/etc/default/piplayer
+LOG=/var/log/piplayer.log
+PIDFILE=/var/run/piplayer.pid
+NAME=$DAEMON
+DESC="Rpi piplayer"
+
+test -f $CONF || exit 0
+. $CONF
+
+if [ ! "x$START_DAEMON" = "xyes" -a ! "$1" = "stop" ]; then
+ echo "Edit $CONF to start piplayer"
+ exit 0
+fi
+
+#test -f $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+
+case "$1" in
+ start)
+ log_begin_msg "Starting piplayer:" "piplayer"
+ $DAEMON $PLAYLIST_DIR > $LOG &
+ pid=`pgrep -u ${USER} $DAEMON`
+ if [ pid = '' ]; then
+ log_failure_msg "PiPlayer daemon can't be started! Check logfile: $LOG"
+ log_end_msg 1
+ else
+ echo $pid > $PIDFILE
+ log_end_msg 0
+ fi
+
+ ;;
+
+ stop)
+ log_begin_msg "Stopping piplayer:" "piplayer"
+ pid=`cat $PIDFILE | sed -e 's/\s.*//'|head -n1`
+ if [ ! pid = '' ]; then
+ pkill -9 -f "piplayer $PLAYLIST_DIR"
+ log_end_msg 0
+ else
+ log_end_msg 1
+ exit 1
+ fi
+ rm $PIDFILE
+ ;;
+
+esac
+
+exit 0