Browse Source

Created init-script

Michael Schwarz 7 years ago
parent
commit
ff3f80d4c9
1 changed files with 52 additions and 0 deletions
  1. 52 0
      initd/ffpb-debugserver

+ 52 - 0
initd/ffpb-debugserver

@@ -0,0 +1,52 @@
+#! /bin/sh
+
+### BEGIN INIT INFO
+# Provides:		ffpb-debugserver
+# Required-Start:	$remote_fs $syslog
+# Required-Stop:	$remote_fs $syslog
+# Default-Start:	2 3 4 5
+# Default-Stop:		
+# Short-Description:	Freifunk Paderborn debugserver
+### END INIT INFO
+
+set -e
+
+umask 022
+
+if test -f /etc/default/ffpb-debugserver; then
+    . /etc/default/ffpb-debugserver
+fi
+
+. /lib/lsb/init-functions
+
+export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
+
+case "$1" in
+  start)
+	log_daemon_msg "Starting Freifunk Paderborn Debugserver" "ffpb-debugserver" || true
+	if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/ffpb-debugserver.pid --exec /opt/debugserver/server.py -- $DEBUGSERVER_OPTS; then
+	    log_end_msg 0 || true
+	else
+	    log_end_msg 1 || true
+	fi
+	;;
+  stop)
+	log_daemon_msg "Stopping Freifunk Paderborn Debugserver" "ffpb-debugserver" || true
+	if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/ffpb-debugserver.pid; then
+	    log_end_msg 0 || true
+	else
+	    log_end_msg 1 || true
+	fi
+	;;
+
+  restart)
+	stop
+	start
+	;;
+
+  *)
+	log_action_msg "Usage: $0 {start|stop|restart}" || true
+	exit 1
+esac
+
+exit 0