diff --git a/etc/initsystem/prepare-dirs b/etc/initsystem/prepare-dirs index 5e36f10db..8472466e9 100644 --- a/etc/initsystem/prepare-dirs +++ b/etc/initsystem/prepare-dirs @@ -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 diff --git a/etc/initsystem/safe-reload b/etc/initsystem/safe-reload index f49f29f6b..70a1a4aba 100644 --- a/etc/initsystem/safe-reload +++ b/etc/initsystem/safe-reload @@ -1,20 +1,20 @@ #!/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" @@ -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