forked from zorkian/nagios-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nagios-api-initd
executable file
·63 lines (52 loc) · 1020 Bytes
/
nagios-api-initd
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
#!/bin/bash
#
# /etc/rc.d/init.d/nagios-api
#
# Starts the Nagios API
# (RedHat/CentOS only!)
#
# chkconfig: 2345 90 10
# description: Nagios API Daemon
# processname: nagios-api
source /etc/rc.d/init.d/functions
PROG="nagios-api"
DESC="Nagios API Daemon"
RETVAL=0
LOGFILE="/var/log/nagios/nagios-api.log"
NAG_API_BIN=/usr/bin/nagios-api
NAG_API_PORT=6315
NAG_API_PID=/var/run/$PROG.pid
NAGIOS_STATUS_FILE=/var/log/nagios/status.dat
NAGIOS_COMMAND_FILE=/var/spool/nagios/cmd/nagios.cmd
NAGIOS_LOG_FILE=/var/log/nagios/nagios.log
start() {
echo -n "Starting $DESC ($PROG): "
daemon $NAG_API_BIN -p $NAG_API_PORT -s $NAGIOS_STATUS_FILE -c $NAGIOS_COMMAND_FILE -l $NAGIOS_LOG_FILE > $LOGFILE 2>&1 &
echo
RETVAL=$?
return $RETVAL
}
stop() {
echo -n "Shutting down $DESC ($PROG): "
killproc $PROG
echo
RETVAL=$?
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL