#!/bin/sh

DAEMON=/usr/sbin/osirisd
NAME=osirisd
DESC="Osiris scanning agent"
ROOT=/var/lib/osirisd

test -x $DAEMON || exit 0

stop () {
    start-stop-daemon --stop --oknodo --quiet \
	--exec $DAEMON
}

start () {
    start-stop-daemon --start --oknodo --quiet \
	--chuid osirisd --exec $DAEMON -- -r $ROOT
}

case "$1" in
    start)
	echo -n "Starting $DESC: "
	start
	echo "$NAME."
	;;
    stop)
	echo -n "Stopping $DESC: "
	stop
	echo "$NAME."
	;;
    restart|force-reload)
	echo -n "Restarting $DESC: "
	stop
	start
	echo "$NAME."
	;;
    *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
