#! /bin/sh
#
# /etc/init.d/netsaint-statd
#
#	Originally written by Miquel van Smoorenburg <miquels@cistron.nl>.
#	Modified for Debian GNU/Linux
#	by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
#	netsaint-statd modifications by tony mancill <tmancill@debian.org>
#
# Version:	@(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/netsaint_statd
NAME=netsaint_statd
DESC="NetSaint status daemon ..."
PIDFILE=/var/run/$NAME.pid

test -f $DAEMON || exit 0

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	touch $PIDFILE && chown nobody $PIDFILE
	start-stop-daemon --start --quiet --pidfile $PIDFILE \
		--chuid nobody --exec $DAEMON
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --quiet --pidfile $PIDFILE  \
		--name $NAME --oknodo
	rm -f $PIDFILE
	echo "$NAME."
	;;
  restart|force-reload)
	$0 stop
	sleep 1
	$0 start
	;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
