#!/bin/sh
#
# 	/etc/init.d/nessusd
#
# Start the nessus daemon.
#
# chkconfig: 345 40 60
# description:  Nessusd is a security auditing tool
#              
# processname nessusd

# source function library.
. /etc/rc.d/init.d/functions

EXE=/usr/sbin/nessusd
[ -x "$EXE" ] || exit

LOCKFILE=/var/lock/subsys/nessusd
OPTIONS="--background"

RETVAL=0

start ()
{	echo -n "Starting $EXE daemon:"
	daemon "$EXE" "$OPTIONS"
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch "$LOCKFILE"
	echo
}

stop ()
{
	echo -n "Stopping $EXE daemon: "
	killproc "$EXE"
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f "$LOCKFILE"
	echo
}

restart()
{
	stop
	start
}

case "$1" in
  start)
	start 
  	;;
  stop)
  	stop
	;;
  reload|restart)
  	restart
	;;
  condstop)
        if [ -e "$LOCKFILE" ]; then
	   stop
        fi
	;;
  condrestart)
	if [ -e "$LOCKFILE" ]; then
	    restart
	fi
	;;
  status)
	status "$EXE"
	;;
  *)
        echo "Usage: ${0##*/} {start|stop|reload|restart|condstop|condrestart|status}"
	RETVAL=1
esac

exit $RETVAL 
