]> granicus.if.org Git - icinga2/commitdiff
Debian: Added DAEMON_(USER|GROUP) to init/default for config checking.
authorMarkus Frosch <markus@lazyfrosch.de>
Wed, 11 Dec 2013 13:43:27 +0000 (14:43 +0100)
committerMarkus Frosch <markus@lazyfrosch.de>
Wed, 11 Dec 2013 14:31:54 +0000 (15:31 +0100)
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
debian/icinga2-common.icinga2.init

index b24f3ddeb7f4aa6506f73b49c6b957eb270f2780..e5065b4fac90ad8da6d69a698186e288d97dfb55 100644 (file)
@@ -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"
index f980465747b26c535713ec32ce2609d30dd7fd95..1c382133803aff6059007963038b50a36d473448 100644 (file)
@@ -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