From 4c8f1f3d9d020388fcea5203ea93af853dde5410 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 11 Dec 2013 14:43:27 +0100 Subject: [PATCH] Debian: Added DAEMON_(USER|GROUP) to init/default for config checking. Config should be checked with the actual uid/gid Icinga 2 will run under. Also moved "-d" to the actual start-stop-daemon call. Fixes #5299 --- debian/icinga2-common.icinga2.default | 4 +++- debian/icinga2-common.icinga2.init | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/debian/icinga2-common.icinga2.default b/debian/icinga2-common.icinga2.default index b24f3ddeb..e5065b4fa 100644 --- a/debian/icinga2-common.icinga2.default +++ b/debian/icinga2-common.icinga2.default @@ -1,4 +1,6 @@ # default settings for icinga2's initscript #DAEMON_CONFIG="/etc/icinga2/icinga2.conf" -#DAEMON_ARGS="-e /var/log/icinga2/icinga2.err -d -u nagios -g nagios" +#DAEMON_USER=nagios +#DAEMON_GROUP=nagios +#DAEMON_ARGS="-e /var/log/icinga2/icinga2.err" diff --git a/debian/icinga2-common.icinga2.init b/debian/icinga2-common.icinga2.init index f98046574..1c3821338 100644 --- a/debian/icinga2-common.icinga2.init +++ b/debian/icinga2-common.icinga2.init @@ -18,7 +18,9 @@ DESC="icinga2 monitoring daemon" NAME=icinga2 DAEMON=/usr/sbin/icinga2 DAEMON_CONFIG="/etc/icinga2/icinga2.conf" -DAEMON_ARGS="-e /var/log/icinga2/icinga2.err -d -u nagios -g nagios" +DAEMON_USER=nagios +DAEMON_GROUP=nagios +DAEMON_ARGS="-e /var/log/icinga2/icinga2.err" PIDFILE=/var/run/icinga2/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME @@ -49,10 +51,10 @@ check_run () { } check_config () { - if ! $DAEMON --validate -c "$DAEMON_CONFIG" >/dev/null 2>&1; then - # blark output - $DAEMON --validate -c "$DAEMON_CONFIG" - fi + if ! $DAEMON --validate -u "$DAEMON_USER" -g "$DAEMON_GROUP" -c "$DAEMON_CONFIG" >/dev/null 2>&1; then + # blark output + $DAEMON --validate -u "$DAEMON_USER" -g "$DAEMON_GROUP" -c "$DAEMON_CONFIG" + fi } @@ -68,7 +70,7 @@ do_start() start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ - -c "$DAEMON_CONFIG" $DAEMON_ARGS \ + -c "$DAEMON_CONFIG" -u "$DAEMON_USER" -g "$DAEMON_GROUP" -d $DAEMON_ARGS \ || return 2 # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend