[icinga-checkins] icinga.org: icinga-core/r1.6: modifications to init scripts

git at icinga.org git at icinga.org
Wed Nov 9 16:43:13 CET 2011


Module: icinga-core
Branch: r1.6
Commit: 5bbc81f7315c66cdae5ce9cecc97ed76123c475b
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=5bbc81f7315c66cdae5ce9cecc97ed76123c475b

Author: Assaf Flatto <icinga at flatto.net>
Date:   Tue Oct 25 11:12:10 2011 +0100

modifications to init scripts

---

 daemon-init-redhat.in |   14 ++++++++++++++
 daemon-init.in        |   10 +++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/daemon-init-redhat.in b/daemon-init-redhat.in
index 6e456f4..55f196c 100644
--- a/daemon-init-redhat.in
+++ b/daemon-init-redhat.in
@@ -28,6 +28,19 @@ user="@icinga_user@"
 
 lockfile=/var/lock/subsys/$prog
 
+pid_lock() {
+    if [ -e $pidfile ] ; then 
+	pproc=`ps auxww |grep (cat "$pidfile") `
+	echo "Icinga Process PID file present"
+	 if [ -z $pproc ] ; then 
+	    rm -f $pidfile
+	    echo "PID file removed and $pidfile process is not active on system"
+	fi 
+    fi 
+    exit 
+}
+
+
 start() {
     [ -x $exec ] || exit 5
     [ -f $config ] || exit 6
@@ -78,6 +91,7 @@ check_config() {
 
 case "$1" in
     start)
+	pid_lock
         status $prog && exit 0
 	check_config
         $1
diff --git a/daemon-init.in b/daemon-init.in
index d846174..47fcb48 100644
--- a/daemon-init.in
+++ b/daemon-init.in
@@ -99,7 +99,15 @@ pid_icinga ()
 	if test ! -f $IcingaRunFile; then
 		echo "Icinga not running. No lock file found in $IcingaRunFile"
 		exit 1
-	fi
+	elif [ -e $IcingaRunFile ] ; then
+    	    pproc=`ps auxww |grep $IcingaPID `
+    	    echo "Icinga Process PID file present"
+    	     if [ -z $pproc ] ; then
+        	rm -f $IcingaRunFile
+    		echo "PID file removed and $IcingaPID process is not active on system"
+	     fi
+        fi
+        exit 1
 
 	IcingaPID=`head -n 1 $IcingaRunFile`
 }





More information about the icinga-checkins mailing list