2014-12-11 09:27:31 +01:00
|
|
|
#!/bin/sh
|
|
|
|
# load system specific defines
|
|
|
|
SYSCONFIGFILE=$1
|
2015-10-21 14:41:48 +02:00
|
|
|
if [ ! -f "$SYSCONFIGFILE" ]; then
|
|
|
|
echo "Error: You need to supply the path to the Icinga2 sysconfig file as a parameter."
|
2014-12-11 09:27:31 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-10-21 14:41:48 +02:00
|
|
|
. $SYSCONFIGFILE
|
|
|
|
|
2014-12-11 09:27:31 +01:00
|
|
|
printf "Validating config files: "
|
|
|
|
|
|
|
|
OUTPUTFILE=`mktemp`
|
2015-03-17 22:23:02 +01:00
|
|
|
|
2015-12-04 15:49:36 +01:00
|
|
|
if type selinuxenabled >/dev/null 2>&1; then
|
|
|
|
if selinuxenabled; then
|
2016-08-15 13:15:56 +02:00
|
|
|
chcon -t icinga2_tmp_t $OUTPUTFILE >/dev/null 2>&1
|
2015-12-04 15:49:36 +01:00
|
|
|
fi
|
2015-10-21 14:41:48 +02:00
|
|
|
fi
|
2014-12-11 09:27:31 +01:00
|
|
|
|
|
|
|
if ! $DAEMON daemon --validate --color > $OUTPUTFILE; then
|
|
|
|
echo "Failed"
|
|
|
|
|
|
|
|
cat $OUTPUTFILE
|
|
|
|
rm -f $OUTPUTFILE
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Done"
|
|
|
|
rm -f $OUTPUTFILE
|
|
|
|
|
|
|
|
printf "Reloading Icinga 2: "
|
|
|
|
|
|
|
|
if [ ! -e $ICINGA2_PID_FILE ]; then
|
|
|
|
exit 7
|
|
|
|
fi
|
|
|
|
|
|
|
|
pid=`cat $ICINGA2_PID_FILE`
|
2015-10-21 14:41:48 +02:00
|
|
|
if ! kill -HUP $pid >/dev/null 2>&1; then
|
2014-12-11 09:27:31 +01:00
|
|
|
echo "Error: Icinga not running"
|
|
|
|
exit 7
|
|
|
|
fi
|
|
|
|
|
2015-10-21 14:41:48 +02:00
|
|
|
echo "Done"
|
2014-12-11 09:27:31 +01:00
|
|
|
exit 0
|