#!/bin/sh

### BEGIN INIT INFO
# Provides: osirisd
# Required-start: $local_fs $network $syslog
# Required-stop: $local_fs $network $syslog
# Default-start: 2 3 4 5
# Default-stop: 0 1 6
# Short-Description: Osiris scanning agent
### END INIT INFO

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 --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
