Fix: 'which' isn't available on minimal CentOS installs

fixes #10417
This commit is contained in:
Gunnar Beutner 2015-10-21 14:41:48 +02:00
parent e93dd3cf15
commit 2a2da04af6
2 changed files with 10 additions and 11 deletions

View File

@ -47,7 +47,7 @@ fi
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

View File

@ -1,21 +1,21 @@
#!/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
if env chcon >/dev/null 2&>1; then
chcon -t icinga2_tmp_t $OUTPUTFILE
fi
if ! $DAEMON daemon --validate --color > $OUTPUTFILE; then
echo "Failed"
@ -34,11 +34,10 @@ if [ ! -e $ICINGA2_PID_FILE ]; then
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