Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
openvas-administrator
debian.openvas-administrator.init
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File debian.openvas-administrator.init of Package openvas-administrator
#!/bin/sh -e # # /etc/init.d/openvas-administrator # ### BEGIN INIT INFO # Provides: openvas-administrator # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: # Should-Stop: # Default-Start: # Default-Stop: 0 6 # Short-Description: Start and stop the OpenVAS Administrator # Description: Controls the OpenVAS daemon "openvasad". ### END INIT INFO # time to wait for daemons death, in seconds # don't set it too low or you might not let openvasad die gracefully DODTIME=5 # Read config [ -r /etc/default/openvas-administrator ] && . /etc/default/openvas-administrator [ "ADMINISTRATOR_ADDRESS" ] && DAEMONOPTS="--listen="$ADMINISTRATOR_ADDRESS [ "ADMINISTRATOR_PORT" ] && DAEMONOPTS="$DAEMONOPTS --port="$ADMINISTRATOR_PORT [ "USER_DATA" ] && DAEMONOPTS="$DAEMONOPTS --users-dir="$USER_DATA [ "SCANNER_CONFIG" ] && DAEMONOPTS="$DAEMONOPTS --scanner-config-file="$SCANNER_CONFIG [ "SYNC_SCRIPT" ] && DAEMONOPTS="$DAEMONOPTS --sync-script="$SYNC_SCRIPT DAEMON=/usr/sbin/openvasad PIDFILE=/var/run/openvasad.pid NAME=openvasad LABEL="OpenVAS Administrator" test -x $DAEMON || exit 0 running() { # No pidfile, probably no daemon present # [ ! -f "$PIDFILE" ] && return 1 pid=`cat $PIDFILE` # No pid, probably no daemon present [ -z "$pid" ] && return 1 [ ! -d /proc/$pid ] && return 1 cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1` # No openvasad? [ `basename "$cmd"` != "$NAME" ] && return 1 return 0 } start_daemon() { start-stop-daemon --start --exec $DAEMON -- $DAEMONOPTS 2>&1 >/dev/null errcode=$? # If we don't sleep then running() might not see the pidfile sleep $DODTIME return $errcode } force_stop() { [ ! -e "$PIDFILE" ] && return if running ; then kill -15 $pid # Is it really dead? sleep "$DODTIME"s if running ; then kill -9 $pid sleep "$DODTIME"s if running ; then echo "Cannot kill $LABEL (pid=$pid)!" exit 1 fi fi fi rm -f $PIDFILE } case "$1" in start) echo -n "Starting $LABEL: " if start_daemon && running ; then echo "openvasad." else echo "ERROR." exit 1 fi ;; stop) echo -n "Stopping $LABEL: " if running ; then start-stop-daemon --stop --pidfile $PIDFILE --quiet --oknodo --exec $DAEMON sleep "$DODTIME"s fi if running; then force_stop fi echo "openvasad." ;; restart) echo -n "Restarting $LABEL: " if running; then start-stop-daemon --stop --pidfile $PIDFILE --quiet --oknodo --exec $DAEMON sleep "$DODTIME"s fi if running; then force_stop fi if start_daemon && running ; then echo "openvasad." else echo "ERROR." exit 1 fi ;; reload|force-reload) echo -n "Reloading $LABEL configuration files: " start-stop-daemon --stop --pidfile $PIDFILE --signal 1 --exec $DAEMON sleep "$DODTIME"s if running ; then echo "done." else echo "ERROR." exit 1 fi ;; status) echo -n "$LABEL is " if running ; then echo "running" else echo " not running." exit 1 fi ;; *) echo "Usage: /etc/init.d/openvas-administrator {start|stop|restart|reload|status}" exit 1 ;; esac exit 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor