#! /bin/sh ### BEGIN INIT INFO # Provides: thruk # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the thruk server # Description: starts thruk using start-stop-daemon ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/opt/thruk/script/thruk_server.pl PID=/var/run/thruk.pid NAME=thruk DESC=thruk test -x $DAEMON || exit 0 # Include thruk defaults if available if [ -f /etc/default/thruk ] ; then . /etc/default/thruk fi set -e case "$1" in start) echo -n "Starting $DESC: " $DAEMON & echo "$NAME." ;; stop) echo -n "Stopping $DESC: " ps -ef | grep thruk_server | grep -v grep | awk '{ print $2 }' > $PID kill `cat $PID` rm -f $PID echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " ps -ef | grep thruk_server | grep -v grep | awk '{ print $2 }' > $PID kill `cat $PID` rm -f $PID sleep 1 $DAEMON & echo "$NAME." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0