2014-12-11 09:27:31 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-06-18 10:27:35 +02:00
|
|
|
# Load sysconf on systems where the initsystem does not pass the environment
|
2018-06-15 17:04:28 +02:00
|
|
|
if [ "$1" != "" ]; then
|
2018-06-18 10:27:35 +02:00
|
|
|
if [ -r "$1" ]; then
|
|
|
|
source "$1"
|
|
|
|
else
|
|
|
|
echo "Unable to read sysconf from '$1'. Exiting." && exit 6
|
|
|
|
fi
|
2018-06-15 17:04:28 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Set defaults, to overwrite see "@ICINGA2_SYSCONFIGFILE@"
|
|
|
|
|
2018-05-23 13:37:29 +02:00
|
|
|
: ${ICINGA2_PID_FILE:="@ICINGA2_RUNDIR@/icinga2/icinga2.pid"}
|
|
|
|
: ${DAEMON:="@CMAKE_INSTALL_FULL_SBINDIR@/icinga2"}
|
2015-10-21 14:41:48 +02:00
|
|
|
|
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
|