[omd-commits] OMD Git: omd: PNP4Nagios: init hooks added

git version control git at mathias-kettner.de
Sun Nov 18 12:54:26 CET 2012


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

Author:   Joerg Linge <pitchfork at pnp4nagios.org>
Date:     Sun Nov 18 12:54:02 2012 +0100
Commiter: Joerg Linge <pitchfork at pnp4nagios.org>
Date:     Sun Nov 18 12:54:02 2012 +0100

PNP4Nagios: init hooks added

---

 Changelog                                          |    2 +
 packages/pnp4nagios/skel/etc/init.d/npcd           |   35 ++++++++++++--------
 .../pnp4nagios/skel/etc/init.d/pnp_gearman_worker  |    6 +++-
 3 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/Changelog b/Changelog
index c996277..4256387 100644
--- a/Changelog
+++ b/Changelog
@@ -6,6 +6,8 @@ This file documents the revision history for the Open Monitoring Distribution
          - Apache: Enabling mod_status (if available) for 127.0.0.1 in own mode
          - Check_MK/MK Livestatus: new version 1.2.0p3
          - NagVis: Update to 1.7.3
+         - PNP4Nagios
+            - Added INIT hooks to npcd and pnp_gearman_worker scripts
 
 0.56     Sep 25 2012
           - omd:
diff --git a/packages/pnp4nagios/skel/etc/init.d/npcd b/packages/pnp4nagios/skel/etc/init.d/npcd
index c79fb2c..6b946e6 100644
--- a/packages/pnp4nagios/skel/etc/init.d/npcd
+++ b/packages/pnp4nagios/skel/etc/init.d/npcd
@@ -14,6 +14,10 @@
 #
 # File : npcd
 #
+
+cd ###ROOT###
+. ###ROOT###/.profile
+. ###ROOT###/etc/omd/site.conf
   
 servicename=npcd
 prefix=###ROOT###
@@ -110,8 +114,8 @@ if [ ! -f $NpcdCfgFile ]; then
 fi
           
 # See how we were called.
+__init_hook $0 $1 pre
 case "$1" in
-
     start)
         status_npcd
         if [ $? -eq 0 ]; then
@@ -124,6 +128,7 @@ case "$1" in
         $NpcdBin -d -f $NpcdCfgFile
         if [ -d $NpcdLockDir ]; then touch $NpcdLockDir/$NpcdLockFile; fi
         echo "OK"
+	__init_hook $0 $1 post
         exit 0
         ;;
 
@@ -138,31 +143,33 @@ case "$1" in
         pid_npcd
         killproc_npcd npcd
 
-         # now we have to wait for npcd to exit and remove its
-         # own NpcdRunFile, otherwise a following "start" could
-         # happen, and then the exiting npcd will remove the
-         # new NpcdRunFile, allowing multiple npcd daemons
-         # to (sooner or later) run - John Sellens
-        #echo -n 'Waiting for npcd to exit .'
-         for i in 1 2 3 4 5 6 7 8 9 10 ; do
+        # now we have to wait for npcd to exit and remove its
+        # own NpcdRunFile, otherwise a following "start" could
+        # happen, and then the exiting npcd will remove the
+        # new NpcdRunFile, allowing multiple npcd daemons
+        # to (sooner or later) run - John Sellens
+        # echo -n 'Waiting for npcd to exit .'
+        for i in 1 2 3 4 5 6 7 8 9 10 ; do
              if status_npcd > /dev/null; then
              echo -n '.'
              sleep 1
              else
              break
              fi
-         done
-         if status_npcd > /dev/null; then
+	done
+        if status_npcd > /dev/null; then
              echo ''
              echo 'Warning - $servicename did not exit in a timely manner'
-         else
+        else
              echo 'OK'
-         fi
+        fi
         rm -f $NpcdLockDir/$NpcdLockFile 
+	__init_hook $0 $1 post
+	exit 0
         ;;
 
-        status)
-            printstatus_npcd
+    status)
+        printstatus_npcd
         ;;
 
     restart|reload)
diff --git a/packages/pnp4nagios/skel/etc/init.d/pnp_gearman_worker b/packages/pnp4nagios/skel/etc/init.d/pnp_gearman_worker
index cb2399e..07d2c0c 100644
--- a/packages/pnp4nagios/skel/etc/init.d/pnp_gearman_worker
+++ b/packages/pnp4nagios/skel/etc/init.d/pnp_gearman_worker
@@ -13,7 +13,10 @@
 
 #### OMD ###
 # Check if Mod-Gearman is enabled in OMD. If not terminate.
-. etc/omd/site.conf
+cd ###ROOT###
+. ###ROOT###/.profile
+. ###ROOT###/etc/omd/site.conf
+
 if [ "$CONFIG_MOD_GEARMAN" != "on" -o "$CONFIG_PNP4NAGIOS" != "gearman" ] ; then
     exit 5
 fi
@@ -69,6 +72,7 @@ function kill_procs() {
     fi
 }
 
+__init_hook $0 $1 pre
 case "$1" in
     start)
         echo -n "Starting $NAME "



More information about the omd-commits mailing list