#!/bin/sh # # LSB compatible service control script; see http://www.linuxbase.org/spec/ # ### BEGIN INIT INFO # Provides: openvassd # 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 Scanner daemon # Description: Start OpenVAS Scanner daemon to allow clients to connect and run scans. ### END INIT INFO # # Source function library. . /etc/rc.d/init.d/functions EXEC="/usr/sbin/openvassd" 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/openvassd.conf || { gprintf "/etc/openvas/openvassd.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 openvassd.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