]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
Add init script for webhook_post2querystring
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Tue, 28 Oct 2014 11:26:19 +0000 (12:26 +0100)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Tue, 28 Oct 2014 11:26:19 +0000 (12:26 +0100)
webhook_post2querystring.init [new file with mode: 0755]

diff --git a/webhook_post2querystring.init b/webhook_post2querystring.init
new file mode 100755 (executable)
index 0000000..3d841e5
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          webhook_post2querystring
+# Required-Start:    $network $syslog
+# Required-Stop:     $network $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: webhook_post2querystring.py
+# Description:       Transforms a Gitlab webhook post data to a query string
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+NAME=webhook_post2querystring
+DAEMON=/usr/local/bin/${NAME}.py
+DAEMON_ARGS="5000"
+DESC=webhook_post2querystring
+PIDFILE=/var/run/$NAME.pid
+USER=bdrung
+GROUP=nogroup
+
+. /lib/lsb/init-functions
+
+case "$1" in
+    start)
+        log_daemon_msg "Starting ${DESC}"
+        start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \
+            --background --oknodo --exec $DAEMON -c $USER --group $GROUP -- $DAEMON_ARGS
+        log_end_msg $?
+        ;;
+    stop)
+        log_daemon_msg "Stopping ${DESC}"
+        start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
+        log_end_msg $?
+        ;;
+    restart|reload|force-reload)
+        $0 stop
+        $0 start
+        ;;
+    status)
+        status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
+        ;;
+    *)
+        echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload|status}" >&2
+        exit 1
+        ;;
+esac
+