summaryrefslogtreecommitdiffstats
path: root/network/nessus/rc.nessusd
diff options
context:
space:
mode:
Diffstat (limited to 'network/nessus/rc.nessusd')
-rw-r--r--network/nessus/rc.nessusd112
1 files changed, 112 insertions, 0 deletions
diff --git a/network/nessus/rc.nessusd b/network/nessus/rc.nessusd
new file mode 100644
index 0000000000..a4a9c47376
--- /dev/null
+++ b/network/nessus/rc.nessusd
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+# Tenable(TM) Nessus Scanner Start & Stop script
+#
+
+# Source function library.
+if [ -f /etc/init.d/functions ] ; then
+ . /etc/init.d/functions
+else
+ exit 0
+fi
+
+# Load nessusd environment
+[ -f /etc/sysconfig/nessusd ] && . /etc/sysconfig/nessusd
+
+# Avoid using root's TMPDIR
+unset TMPDIR
+
+test -x /opt/nessus/sbin/nessus-service || {
+ echo "Nessus not properly installed"
+ exit 1
+}
+
+RETVAL=0
+
+NESSUS_PID_FILE="/opt/nessus/var/nessus/nessus-service.pid"
+NESSUS_NAME="Nessus"
+
+start() {
+
+ echo -n $"Starting Nessus services: "
+
+ /opt/nessus/sbin/nessus-service -q -D
+ RETVAL=$?
+
+ if [ "$RETVAL" == "0" ]; then
+ success
+ else
+ failure
+ fi
+
+ echo
+ return 0
+
+}
+
+stop() {
+
+ echo -n $"Shutting down Nessus services: "
+
+ test -f "$NESSUS_PID_FILE" && kill `cat /opt/nessus/var/nessus/nessus-service.pid`
+ RETVAL=$?
+
+ sleep 4
+
+ if [ "$RETVAL" == "0" ]; then
+ success
+ else
+ failure
+ fi
+
+ echo
+ return 0
+
+}
+
+restart() {
+ stop
+ start
+}
+
+status() {
+
+ if [ -f "$NESSUS_PID_FILE" ]; then
+
+ exp_pid=$(cat $NESSUS_PID_FILE)
+ pid_dir="/proc/$exp_pid"
+
+ if [ -d "$pid_dir" ]; then
+ if [ "$(cat ${pid_dir}/stat | awk '{print $2}' | tr -d '()')" == "nessus-service" ]; then
+ echo "$NESSUS_NAME is running"
+ return 0
+ fi
+ fi
+
+ fi
+
+ echo "$NESSUS_NAME is not running"
+ return 3
+
+}
+
+
+case "$1" in
+ start)
+ start
+ ;;
+ status)
+ status
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|status}"
+ exit 1
+esac
+
+exit $?