[omd-commits] OMD Git: omd: Init scripts return exit 0 when executing start and daemon is already running

git version control git at mathias-kettner.de
Thu Jul 17 16:09:52 CEST 2014


Module:   omd
Branch:   master
Commit:   e525b7263a4612489645d53a6b5388440bfdbf73
URL:      http://omdistro.org/projects/omd/repository/revisions/e525b7263a4612489645d53a6b5388440bfdbf73

Author:   Lars Michelsen <lm at mathias-kettner.de>
Date:     Thu Jul 17 16:06:18 2014 +0200
Commiter: Lars Michelsen <lm at mathias-kettner.de>
Date:     Thu Jul 17 16:06:18 2014 +0200

Init scripts return exit 0 when executing start and daemon is already running

---

 Changelog                                  |    2 ++
 packages/apache-omd/skel/etc/init.d/apache |    2 +-
 packages/nagios/skel/etc/init.d/nagios     |    5 +++--
 packages/rrdtool/skel/etc/init.d/rrdcached |    4 ++--
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Changelog b/Changelog
index 332f841..8e26c9d 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,8 @@ This file documents the revision history for the Open Monitoring Distribution
             - FIX: exit with 2 (partially running) when only some of the
               sites are running or partially running using "omd status"
             - FIX: Reducing duplicate config writes during site creation
+          - Init scripts return exit 0 when executing start and daemon is
+            already running (Modified nagios, apache and rrdcached scripts)
           - diskspace: Fixed error messages in syslog which were caused by
             exit codes of 3 when diskspace cleanup has not been configured
           - Check_MK/MK Livestatus: new version 1.2.4p5
diff --git a/packages/apache-omd/skel/etc/init.d/apache b/packages/apache-omd/skel/etc/init.d/apache
index e01b87f..5201b35 100644
--- a/packages/apache-omd/skel/etc/init.d/apache
+++ b/packages/apache-omd/skel/etc/init.d/apache
@@ -76,7 +76,7 @@ apache_wait_stop() {
 apache_wait_start() {
   if pidof_apache >/dev/null 2>&1; then
     echo -n '(already running)...'
-    return 1
+    return 0
   fi
 
   mkdir -p ###ROOT###/tmp/apache/run
diff --git a/packages/nagios/skel/etc/init.d/nagios b/packages/nagios/skel/etc/init.d/nagios
index ca596de..b234726 100755
--- a/packages/nagios/skel/etc/init.d/nagios
+++ b/packages/nagios/skel/etc/init.d/nagios
@@ -25,7 +25,8 @@
 # - There are exceptions for the exit code handling:
 #   - When a service is already stopped and should be
 #     restarted/stopped, it should result in an exit code of 0.
-#   - FIXME: What if a service should be started and is already started?
+#   - When a service is already running and should be started
+#     this also should result in an exit code of 0.
 # - When a restart is requested and the program is still not running
 #   the script should only execute a start
 # - When a restart is requested and the program can not be stopped the
@@ -190,7 +191,7 @@ case "$1" in
          echo -n "Starting nagios..."
          if pidof_nagios >/dev/null 2>&1; then
              echo 'Already running.'
-             exit 1
+             exit 0
          fi
 
          [ "$CORE_NOVERIFY" ] || verify_config quiet || exit 1
diff --git a/packages/rrdtool/skel/etc/init.d/rrdcached b/packages/rrdtool/skel/etc/init.d/rrdcached
index 7e625a3..97153f1 100644
--- a/packages/rrdtool/skel/etc/init.d/rrdcached
+++ b/packages/rrdtool/skel/etc/init.d/rrdcached
@@ -50,8 +50,8 @@ case "$1" in
 	if [ -e "$PIDFILE" ] ; then
 	    PID=$(cat $PIDFILE)
 	    if [ -n "$PID" ] && ps $PID > /dev/null 2>&1 ; then
-		echo "still running with pid $PID! Aborting!"
-		exit 1
+		echo "Already running."
+		exit 0
 	    fi
 	    echo "removing stale pid file..."
 	    rm -f $PIDFILE



More information about the omd-commits mailing list