forked from ripienaar/angelia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
angelia.init
executable file
·73 lines (64 loc) · 1.21 KB
/
angelia.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
#!/bin/bash
#
# Init file for the angelia spool daemon
#
# chkconfig: 2345 20 20
# description: Multi protocol nagios notifier
#
# processname: angelia-spoold
# Source function library.
. /etc/rc.d/init.d/functions
desc="Angelia Spool Daemon"
prog="angelia-spoold"
# these can be overrode in /etc/sysconfig/angelia-spoold
CONFFILE=/etc/angelia/angelia.cfg
if [ -r /etc/sysconfig/$prog ]; then
source /etc/sysconfig/$prog
fi
start() {
echo -n $"Starting $desc ($prog): "
touch /var/run/angelia-spoold.pid
chown nagios:nagios /var/run/angelia-spoold.pid
chown -R nagios:nagios /var/log/angelia
umask 0002
daemon --user=nagios --check=$prog /usr/sbin/${prog} --config ${CONFFILE}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
echo -n $"Stopping $desc ($prog): "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
RETVAL=$?
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit $RETVAL