blob: e3b1f8fd67d18d3feb7601181f26a2ec643c6f4f (
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
|
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# opts="${opts} reload configtest"
NX_NODE_CFG="/usr/NX/etc/node.cfg"
NX_SENSOR_CMD="/usr/NX/bin/nxsensor"
NX_SENSOR_PID="/usr/NX/var/run/nxsensor.pid"
NX_SENSOR_HOST="127.0.0.1"
NX_SENSOR_PORT="19250"
depend()
{
need net
}
is_enabled()
{
local tmp
if ! [[ -x $NX_SENSOR_CMD ]] ; then
eerror "$NX_SENSOR_CMD not found"
return 1
fi
tmp=`/usr/bin/awk -F'"' '/^ENABLE_SENSOR/ {print $2}' $NX_NODE_CFG`
if [[ $tmp != "1" ]]; then
eerror "nxsensor is disabled in $NX_NODE_CFG"
return 1
fi
tmp=`/usr/bin/awk -F'"' '/^NODE_SENSOR_HOST/ {print $2}' $NX_NODE_CFG`
if [[ -n $tmp ]] ; then
NX_SENSOR_HOST="$tmp"
fi
tmp=`/usr/bin/awk -F'"' '/^NODE_SENSOR_PORT/ {print $2}' $NX_NODE_CFG`
if [[ -n $tmp ]] ; then
NX_SENSOR_PORT="$tmp"
fi
return 0
}
start() {
is_enabled || return 1
ebegin "Starting nxsensor"
$NX_SENSOR_CMD -a $NX_SENSOR_HOST -a "::ffff:$NX_SENSOR_HOST" -P $NX_SENSOR_PORT -d
PID=`ps -ef | grep $NX_SENSOR_CMD | grep -v grep | awk '{print $2}'`
if [[ -z $PID ]] ; then
eend 1
else
echo $PID > $NX_SENSOR_PID
eend 0
fi
}
stop() {
ebegin "Stopping nxsensor"
PID=`cat $NX_SENSOR_PID`
if [[ -z $PID ]] ; then
eerror "nxsensor not started"
eend 1
else
kill $PID
rm -f $NX_SENSOR_PID
eend 0
fi
}
|