]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/initscripts/init.d/client175
Add client175 (webif for mpd) addon.
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / client175
diff --git a/src/initscripts/init.d/client175 b/src/initscripts/init.d/client175
new file mode 100644 (file)
index 0000000..9f279b7
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/
+#
+# Description : Client175 (MPD Client with Webinterface)
+#
+# Author      : Arne Fitzenreiter
+#
+# Version     : 01.00
+#
+# Notes       : for www.ipfire.org - GPLv3
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "$1" in
+       start)
+               if [ -e /var/run/client175.pid ]; then
+                       if ps -p $(cat /var/run/client175.pid) > /dev/null
+                       then
+                           boot_mesg "Client175 is already running."
+                           echo_failure
+                           exit 0
+                       fi
+               fi
+               boot_mesg "Starting Client175 MPD WebIF..."
+               sudo -u nobody python /srv/client175/server.py > /var/log/client175 2>&1 &
+               echo $! > /var/run/client175.pid
+               evaluate_retval
+               ;;
+
+       stop)
+               if [ ! -e /var/run/client175.pid ]; then
+                       boot_mesg "Client175 pidfile not found!"
+                       echo_failure
+                       exit 0
+               fi
+               boot_mesg "Stopping Client175 MPD WebIF..."
+               kill $(cat /var/run/client175.pid)
+               evaluate_retval
+               rm -f /var/run/client175.pid
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+
+               ;;
+       status)
+               if [ -e /var/run/client175.pid ]; then
+                       if ps -p $(cat /var/run/client175.pid) > /dev/null
+                       then
+
+                               boot_mesg "Client175 is running with Process Id(s) $(cat /var/run/client175.pid)"
+                               exit 0
+                       fi
+               fi
+               boot_mesg "Client175 should not running"
+               exit 0
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|reload|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/