mirror of https://github.com/Icinga/icinga2.git
Make sure that user/group exists when starting Icinga 2
fixes #7173 fixes #7613
This commit is contained in:
parent
cee13fbec0
commit
9818477a44
|
@ -12,8 +12,20 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
ICINGA2_USER=`$DAEMON variable get --current RunAsUser`
|
||||
if [ $? != 0 ]; then
|
||||
echo "Could not fetch RunAsUser variable. Error '$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
|
||||
fi
|
||||
|
||||
getent group $ICINGA2_COMMAND_GROUP >/dev/null 2>&1 || echo "Command group '$ICINGA2_COMMAND_GROUP' does not exist. Exiting." && exit 6
|
||||
|
||||
mkdir -p $(dirname -- $ICINGA2_PID_FILE)
|
||||
chown $ICINGA2_USER:$ICINGA2_GROUP $(dirname -- $ICINGA2_PID_FILE)
|
||||
|
|
|
@ -26,14 +26,25 @@ fi
|
|||
|
||||
test -x $DAEMON || exit 5
|
||||
|
||||
ICINGA2_USER=`$DAEMON variable get --current RunAsUser`
|
||||
ICINGA2_GROUP=`$DAEMON variable get --current RunAsGroup`
|
||||
|
||||
if [ ! -e $ICINGA2_CONFIG_FILE ]; then
|
||||
echo "Config file '$ICINGA2_CONFIG_FILE' does not exist."
|
||||
echo "Config file '$ICINGA2_CONFIG_FILE' does not exist."
|
||||
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
|
||||
fi
|
||||
|
||||
ICINGA2_GROUP=`$DAEMON variable get --current RunAsGroup`
|
||||
if [ $? != 0 ]; then
|
||||
echo "Could not fetch RunAsGroup variable. Error '$ICINGA2_GROUP'. Exiting."
|
||||
exit 6
|
||||
fi
|
||||
|
||||
getent group $ICINGA2_COMMAND_GROUP >/dev/null 2>&1 || echo "Command group '$ICINGA2_COMMAND_GROUP' does not exist. Exiting." && exit 6
|
||||
|
||||
# Get function from functions library
|
||||
if [ -f /etc/rc.d/init.d/functions ]; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
|
Loading…
Reference in New Issue