mkdir -p $ICINGA2_RUN_DIR/icinga2/cmd
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_RUN_DIR/icinga2/cmd
-if [ $(which restorecon) ]; then
+if which restorecon >/dev/null 2&>1; then
restorecon -R $ICINGA2_RUN_DIR/icinga2/
fi
chmod 2750 $ICINGA2_RUN_DIR/icinga2/cmd
#!/bin/sh
# load system specific defines
SYSCONFIGFILE=$1
-if [ -f "$SYSCONFIGFILE" ]; then
- . $SYSCONFIGFILE
-else
- echo "Error: You need to supply the path to the Icinga2 sysconfig file as parameter."
+if [ ! -f "$SYSCONFIGFILE" ]; then
+ echo "Error: You need to supply the path to the Icinga2 sysconfig file as a parameter."
exit 1
fi
+. $SYSCONFIGFILE
+
printf "Validating config files: "
OUTPUTFILE=`mktemp`
-if [ $(which chcon) ]; then
- chcon -t icinga2_tmp_t $OUTPUTFILE
-fi
+if env chcon >/dev/null 2&>1; then
+ chcon -t icinga2_tmp_t $OUTPUTFILE
+fi
if ! $DAEMON daemon --validate --color > $OUTPUTFILE; then
echo "Failed"
fi
pid=`cat $ICINGA2_PID_FILE`
-if kill -HUP $pid >/dev/null 2>&1; then
- echo "Done"
-else
+if ! kill -HUP $pid >/dev/null 2>&1; then
echo "Error: Icinga not running"
exit 7
fi
+echo "Done"
exit 0