summaryrefslogtreecommitdiff
path: root/package/icinga/files/icinga.init
blob: e66944522c4af8df9d7c323c8db5abcef3608e2f (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
#!/bin/sh
#PKG icinga
#INIT 80
. /etc/rc.conf

case $1 in
autostop) ;;
autostart)
	test x"${icinga:-NO}" = x"NO" && exit 0
	exec sh $0 start
	;;
start)
	[ -d /var/run/icinga ] || mkdir -p /var/run/icinga
	[ -d /var/rw ] || mkdir -p /var/rw
	[ -d /var/spool/checkresults ] || mkdir -p /var/spool/checkresults
	touch /var/log/icinga.log
	chown icinga:icinga /var/log/icinga.log
	chown icinga:icinga /var/run/icinga
	chown icinga:icinga /var/spool/checkresults
	chown icinga:icinga /var/rw
	icinga -d /etc/icinga/icinga.cfg
	;;
stop)
	kill $(pgrep -f icinga)
	;;
restart)
	sh $0 stop
	sh $0 start
	;;
*)
	echo "Usage: $0 {start | stop | restart}"
	exit 1
	;;
esac
exit $?