blob: a4a9c47376f057c5fc036530140141c6aed7fa65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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 $?
|