-
Notifications
You must be signed in to change notification settings - Fork 0
/
ireload
executable file
·44 lines (35 loc) · 887 Bytes
/
ireload
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
#!/bin/bash
echo -e "### gwTools Icinga-Reload-Skript ###"
if [ $(id -u) -ne 0 ]; then
echo -e "Script must be run as root. Try 'sudo $0'\n"
exit 1
fi
ICINGASERVICE=""
ICINGAVERSION=0
if [ -f "/etc/icinga/icinga.cfg" ]; then
echo -e "Icinga v1 gefunden!"
ICINGASERVICE="icinga"
ICINGAVERSION=1
elif [ -f "/etc/icinga2/icinga2.conf" ]; then
echo -e "Icinga2 gefunden!"
ICINGASERVICE="icinga2"
ICINGAVERSION=2
else
echo -e "KEINE Icinga-Konfiguration gefunden!"
exit 1
fi
echo -e "Prüfe Konfiguration..."
if (( $ICINGAVERSION == 1 )); then
/usr/sbin/icinga -v /etc/icinga/icinga.cfg
elif (( $ICINGAVERSION == 2 )); then
icinga2 daemon -C
fi
if (( $? != 0 )); then
echo -e "Icinga-Konfiguration FEHLERHAFT!"
exit 1
else
echo -e "Icinga-Konfiguration OK"
fi
echo -e "Dienst $ICINGASERVICE lädt Konfiguration neu..."
service $ICINGASERVICE reload
echo -e "Fertig!"