Finish setup.
[sentry.git] / etc / sentry.initd
diff --git a/etc/sentry.initd b/etc/sentry.initd
new file mode 100755 (executable)
index 0000000..83781ea
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          xorg-sentry
+# Required-Start:    $local_fs $remote_fs $network $syslog
+# Required-Stop:     $local_fs $remote_fs $network $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: starts the xorg-sentry server
+# Description:       starts xorg-sentry using start-stop-daemon
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/home/web/sentry/bin/xorg-sentry
+NAME=xorg-sentry
+DESC=xorg-sentry
+USER=web
+
+# Include xorg-sentry defaults if available
+if [ -f /etc/default/xorg-sentry ]; then
+       . /etc/default/xorg-sentry
+fi
+
+test -x $DAEMON || exit 0
+
+set -e
+
+. /lib/lsb/init-functions
+
+case "$1" in
+       start)
+               echo -n "Starting $DESC: "
+               start-stop-daemon --start --chuid $USER --quiet --pidfile /var/run/$NAME.pid \
+                   --background --exec $DAEMON -- start $DAEMON_OPTS || true
+               echo "$NAME."
+               ;;
+
+       stop)
+               echo -n "Stopping $DESC: "
+               start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
+                   --exec $DAEMON || true
+               echo "$NAME."
+               ;;
+
+       restart|force-reload)
+               echo -n "Restarting $DESC: "
+               start-stop-daemon --stop --quiet --pidfile \
+                   /var/run/$NAME.pid --exec $DAEMON || true
+               sleep 1
+               start-stop-daemon --start --chuid $USER --quiet --pidfile \
+                   /var/run/$NAME.pid --background --exec $DAEMON -- $DAEMON_OPTS || true
+               echo "$NAME."
+               ;;
+
+       status)
+               status_of_proc -p /var/run/$NAME.pid "$DAEMON" xorg-sentry && exit 0 || exit $?
+               ;;
+       *)
+               echo "Usage: $NAME {start|stop|restart|force-reload|status}" >&2
+               exit 1
+               ;;
+esac
+
+exit 0