From 2b5ea38217aff5acb114e45991565f44ce6ac811 Mon Sep 17 00:00:00 2001 From: Jean Flach Date: Fri, 15 Jun 2018 17:04:28 +0200 Subject: [PATCH] Fix sysconfig not bein handled correctly by sysvinit --- etc/initsystem/icinga2.init.d.cmake | 4 ++-- etc/initsystem/prepare-dirs.cmake | 5 +++++ etc/initsystem/safe-reload.cmake | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/etc/initsystem/icinga2.init.d.cmake b/etc/initsystem/icinga2.init.d.cmake index 03c88a632..c37977f57 100644 --- a/etc/initsystem/icinga2.init.d.cmake +++ b/etc/initsystem/icinga2.init.d.cmake @@ -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 diff --git a/etc/initsystem/prepare-dirs.cmake b/etc/initsystem/prepare-dirs.cmake index 2a6c4a262..b7e3b6422 100644 --- a/etc/initsystem/prepare-dirs.cmake +++ b/etc/initsystem/prepare-dirs.cmake @@ -3,6 +3,11 @@ # This script prepares directories and files needed for running Icinga2 # +# With sysvinit we need to pass the environment this way. Or do we? +if [ "$1" != "" ]; then + source "$1" +fi + # Set defaults, to overwrite see "@ICINGA2_SYSCONFIGFILE@" : ${ICINGA2_USER:="@ICINGA2_USER@"} diff --git a/etc/initsystem/safe-reload.cmake b/etc/initsystem/safe-reload.cmake index 57e10b1ac..967e37268 100644 --- a/etc/initsystem/safe-reload.cmake +++ b/etc/initsystem/safe-reload.cmake @@ -1,5 +1,12 @@ #!/bin/sh +# With sysvinit we need to pass the environment this way. Or do we? +if [ "$1" != "" ]; then + source "$1" +fi + +# Set defaults, to overwrite see "@ICINGA2_SYSCONFIGFILE@" + : ${ICINGA2_PID_FILE:="@ICINGA2_RUNDIR@/icinga2/icinga2.pid"} : ${DAEMON:="@CMAKE_INSTALL_FULL_SBINDIR@/icinga2"} -- 2.40.0