]> granicus.if.org Git - icinga2/commitdiff
Get ICINGA2_USER and GROUP from sysconfig
authorJean Flach <jean-marcel.flach@icinga.com>
Wed, 17 Jan 2018 12:25:40 +0000 (13:25 +0100)
committerJean Flach <jean-marcel.flach@icinga.com>
Tue, 20 Feb 2018 13:16:43 +0000 (14:16 +0100)
etc/initsystem/icinga2.init.d.cmake
etc/initsystem/prepare-dirs

index 080fb27796c0ed596fcdbc6e69a9a6e0e9c81c11..ac494a8a25dfeef6f0b755c3c5cfaca3db7af523 100644 (file)
@@ -31,16 +31,14 @@ if [ ! -e $ICINGA2_CONFIG_FILE ]; then
        exit 6
 fi
 
-ICINGA2_USER=`$DAEMON variable get --current RunAsUser`
-if [ $? != 0 ]; then
-        echo "Could not fetch RunAsUser variable. Error '$ICINGA2_USER'. Exiting."
-        exit 6
+if [ ! $ICINGA2_USER ]; then
+       echo "Could not fetch \$ICINGA2_USER. Exiting."
+       exit 6
 fi
 
-ICINGA2_GROUP=`$DAEMON variable get --current RunAsGroup`
-if [ $? != 0 ]; then
-        echo "Could not fetch RunAsGroup variable. Error '$ICINGA2_GROUP'. Exiting."
-        exit 6
+if [ ! $ICINGA2_GROUP ]; then
+       echo "Could not fetch \$ICINGA2_GROUP. Exiting."
+       exit 6
 fi
 
 getent passwd $ICINGA2_USER >/dev/null 2>&1 || (echo "Icinga user '$ICINGA2_USER' does not exist. Exiting." && exit 6)
index 799e3226f8acfbf1e2eedbdccd9ad51ef643dda8..44b8343a8077c593d526ab41f4880db75da80032 100644 (file)
@@ -13,16 +13,14 @@ else
 fi
 
 
-ICINGA2_USER=`$DAEMON variable get --current RunAsUser`
-if [ $? != 0 ]; then
-        echo "Could not fetch RunAsUser variable. Error '$ICINGA2_USER'. Exiting."
-        exit 6
+if [ ! $ICINGA2_USER ]; then
+       echo "Could not fetch \$ICINGA2_USER. Exiting."
+       exit 6
 fi
 
-ICINGA2_GROUP=`$DAEMON variable get --current RunAsGroup`
-if [ $? != 0 ]; then
-        echo "Could not fetch RunAsGroup variable. Error '$ICINGA2_GROUP'. Exiting."
-        exit 6
+if [ ! $ICINGA2_GROUP ]; then
+       echo "Could not fetch \$ICINGA2_GROUP. Exiting."
+       exit 6
 fi
 
 getent passwd $ICINGA2_USER >/dev/null 2>&1 || (echo "Icinga user '$ICINGA2_USER' does not exist. Exiting." && exit 6)