Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > cef68cbd6065201f490859ac0afea9f4 > files > 3

openvas-server-2.0.3-2mdv2010.0.i586.rpm

#!/bin/sh
#
# LSB compatible service control script; see http://www.linuxbase.org/spec/
# 
### BEGIN INIT INFO
# Provides:          openvasd
# Required-Start:    $syslog $remote_fs
# Should-Start:      $time ypbind smtp
# Required-Stop:     $syslog $remote_fs
# Should-Stop:       $time ypbind smtp
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: OpenVAS daemon
# Description:       Start OpenVAS daemon to allow clients to connect and run scans.
### END INIT INFO
#

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

EXEC="/usr/sbin/openvasd"
PROG=$(basename $EXEC)

# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
test -x $EXEC || { gprintf "%s not installed\n" "$EXEC"; 
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

# Check for existence of needed config file
test -r /etc/openvas/openvasd.conf || { gprintf "/etc/openvas/openvasd.conf not existing\n";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }

LOCKFILE=/var/lock/subsys/$PROG

start() {
    gprintf "Starting %s: " "$PROG"
    daemon $EXEC -q
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch $LOCKFILE
    return $RETVAL
}

stop() {
    gprintf "Stopping %s: " "$PROG"
    killproc $PROG
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
    return $RETVAL
}

restart() {
    stop
    start
}

reload() {
    gprintf "Reloading openvasd.conf file: "
    killproc $PROG -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

force_reload() {
    restart
}

fdr_status() {
    status $PROG
}

case "$1" in
    start|stop|restart|reload)
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        fdr_status
        ;;
    condrestart|try-restart)
        [ ! -f $LOCKFILE ] || restart
        ;;
    *)
        gprintf "Usage: %s {start|stop|status|restart|try-restart|reload|force-reload}\n" "$0"
        exit 2
esac