forked from Griesbacher/nagflux
-
Notifications
You must be signed in to change notification settings - Fork 3
/
nagflux.init
82 lines (74 loc) · 1.79 KB
/
nagflux.init
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
#!/bin/bash
#
# nagflux Startup script for nagflux
#
# chkconfig: - 90 20
# description: A connector which copies performancedata from Nagios/Icinga to InfluxDB
# processname: nagflux
### BEGIN INIT INFO
# Provides: nagflux
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog $named
# Should-Stop: $syslog $named
# Short-Description: start and stop nagflux
# Description: A connector which copies performancedata from Nagios/Icinga to InfluxDB
### END INIT INFO
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
prog=nagflux
progpath=/opt/nagflux
OPTIONS="-configPath /opt/nagflux/config.gcfg"
logfile=/var/log/$prog.log
lockfile=/var/lock/subsys/$prog
start() {
[ "$EUID" != "0" ] && exit 4
[ "$NETWORKING" = "no" ] && exit 1
[ -x $progpath/nagflux ] || exit 5
# Start daemons.
echo -n $"Starting $prog: "
nohup $progpath/$prog $OPTIONS > $logfile 2>&1&
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}
stop() {
[ "$EUID" != "0" ] && exit 4
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart|force-reload)
stop
start
;;
try-restart|condrestart)
if status $prog > /dev/null; then
stop
start
fi
;;
reload)
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
esac