#!/sbin/openrc-run
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need net
}

start() {
	ebegin "Starting nessusd"
	start-stop-daemon --start --quiet --exec /usr/sbin/nessusd -- -D
	eend $? 
}

stop() {
	ebegin "Stop nessusd"
	start-stop-daemon --stop --quiet --exec /usr/sbin/nessusd
	einfo "Waiting for the environment to be sane"
	while [ -n "$RUNNING" ] ; do
		sleep 1
		RUNNING=$(ps aux | grep -m 1 nessusd: | grep -v grep)
	done
	sleep 3
	eend $?
}
