#!/bin/sh

### BEGIN INIT INFO
# Provides:          procwatch
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2
# Default-Stop:      0 4 1 6
# Short-Description: Start Procwatch at boot time
# Description:       Enable Procwatch
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/dh/bin/procwatch
ARGS=

case "$1" in
  start)
	echo -n "Starting process-watching daemon: "
        if start-stop-daemon --start --exec $DAEMON -- $ARGS ; then
            echo "procwatch"
        else
            exit 1
        fi
	;;
  stop)
	echo -n "Stopping process-watching daemon: "
        if start-stop-daemon --stop --pidfile /var/run/procwatch.pid ; then
            echo "procwatch"
        else
            echo "failed" # not fatal
        fi
	;;
  restart)
  	sh $0 stop
	sh $0 start
	;;
  *)
	echo "Usage: /etc/init.d/procwatch {start|stop|restart}"
	exit 1
	;;
esac

exit 0
