#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/openvas-server/files/openvasd,v 1.1 2008/02/08 13:08:17 hanno Exp $

depend() {
	need net
}

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

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