Merge pull request #6381 from Icinga/fix/env-sysvinit

Fix sysconfig not being handled correctly by sysvinit
This commit is contained in:
Michael Friedrich 2018-06-21 15:36:10 +02:00 committed by GitHub
commit ad933fb754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -60,7 +60,7 @@ fi
# Start Icinga 2
start() {
printf "Starting Icinga 2: "
@CMAKE_INSTALL_PREFIX@/lib/icinga2/prepare-dirs
@CMAKE_INSTALL_PREFIX@/lib/icinga2/prepare-dirs "$SYSCONFIGFILE"
if ! $DAEMON daemon -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG > $ICINGA2_STARTUP_LOG 2>&1; then
echo "Error starting Icinga. Check '$ICINGA2_STARTUP_LOG' for details."
@ -105,7 +105,7 @@ stop() {
# Reload Icinga 2
reload() {
exec @CMAKE_INSTALL_PREFIX@/lib/icinga2/safe-reload $SYSCONFIGFILE
exec @CMAKE_INSTALL_PREFIX@/lib/icinga2/safe-reload "$SYSCONFIGFILE"
}
# Check the Icinga 2 configuration

View File

@ -3,6 +3,15 @@
# This script prepares directories and files needed for running Icinga2
#
# Load sysconf on systems where the initsystem does not pass the environment
if [ "$1" != "" ]; then
if [ -r "$1" ]; then
source "$1"
else
echo "Unable to read sysconf from '$1'. Exiting." && exit 6
fi
fi
# Set defaults, to overwrite see "@ICINGA2_SYSCONFIGFILE@"
: ${ICINGA2_USER:="@ICINGA2_USER@"}

View File

@ -1,5 +1,16 @@
#!/bin/sh
# Load sysconf on systems where the initsystem does not pass the environment
if [ "$1" != "" ]; then
if [ -r "$1" ]; then
source "$1"
else
echo "Unable to read sysconf from '$1'. Exiting." && exit 6
fi
fi
# Set defaults, to overwrite see "@ICINGA2_SYSCONFIGFILE@"
: ${ICINGA2_PID_FILE:="@ICINGA2_RUNDIR@/icinga2/icinga2.pid"}
: ${DAEMON:="@CMAKE_INSTALL_FULL_SBINDIR@/icinga2"}