[csw-devel] SF.net SVN: gar:[5421] csw/mgar/pkg/nrpe/trunk

j_arndt at users.sourceforge.net j_arndt at users.sourceforge.net
Mon Jun 29 23:13:37 CEST 2009


Revision: 5421
          http://gar.svn.sourceforge.net/gar/?rev=5421&view=rev
Author:   j_arndt
Date:     2009-06-29 21:13:36 +0000 (Mon, 29 Jun 2009)

Log Message:
-----------
nrpe: fixing #3730, start / stop script now handles missing pid file

Modified Paths:
--------------
    csw/mgar/pkg/nrpe/trunk/checksums
    csw/mgar/pkg/nrpe/trunk/files/cswnrpe

Modified: csw/mgar/pkg/nrpe/trunk/checksums
===================================================================
--- csw/mgar/pkg/nrpe/trunk/checksums	2009-06-29 21:10:40 UTC (rev 5420)
+++ csw/mgar/pkg/nrpe/trunk/checksums	2009-06-29 21:13:36 UTC (rev 5421)
@@ -6,6 +6,6 @@
 2b35d5e0d57bcb3aff096040e0d06b8b  download/CSWnrpeplugin.gspec
 e22a7817c7665e79bcbad7e091375be9  download/CSWnrpeplugin.prototype
 4b51476c782d2c5764d10f8ed530ada0  download/configure.diff
-4aad349d0e04e6cb8af186d87c44c3ba  download/cswnrpe
+3276723a3d0c30b489f1a8c93bcbb048  download/cswnrpe
 b2d75e2962f1e3151ef58794d60c9e97  download/nrpe-2.12.tar.gz
 5b02d4385daaea2a8c13903539aa6189  download/patch.diff

Modified: csw/mgar/pkg/nrpe/trunk/files/cswnrpe
===================================================================
--- csw/mgar/pkg/nrpe/trunk/files/cswnrpe	2009-06-29 21:10:40 UTC (rev 5420)
+++ csw/mgar/pkg/nrpe/trunk/files/cswnrpe	2009-06-29 21:13:36 UTC (rev 5421)
@@ -29,16 +29,31 @@
 fi
 
 BIN_FILE="/opt/csw/bin/nrpe"
-pidfile=`grep '^pid_file' $CONFIG_FILE |awk '{ FS = "=" } {print $2;}'`
-NRPE_USER=`awk -F'=' '/nrpe_user/ { print $NF }' $CONFIG_FILE`
+pidfile=`awk -F'=' '/^[ \t]*pid_file/ {print $2}' $CONFIG_FILE`
+NRPE_USER=`awk -F'=' '/^[ \t]*nrpe_user/ { print $2 }' $CONFIG_FILE`
 
 case "$1" in
 'restart')
-        [ -n "`pgrep -x -u 0,1,$NRPE_USER nrpe`" ] && /usr/bin/kill `head -1 $pidfile`
-        # remove pid file
+	#
+	# stop
+	#
+
         if [ -f "$pidfile" ]; then
-            rm "$pidfile"
-        fi
+        	[ -n "`pgrep -x -u 0,1,$NRPE_USER nrpe`" ] && /usr/bin/kill `head -1 $pidfile`
+            	rm "$pidfile"
+	else
+		if [ `uname -r` = 5.8 -o `uname -r` = 5.9 ]
+		then
+			/usr/bin/kill `pgrep -x -u 0,1,$NRPE_USER nrpe`
+		else
+			/usr/bin/kill `pgrep -x -u 0,1,$NRPE_USER -z \`zonename\` nrpe`
+		fi
+	fi
+	
+	#
+	# start
+	#
+
         if [ -f $CONFIG_FILE ]; then
             wait 1
             $BIN_FILE -c $CONFIG_FILE -d
@@ -52,11 +67,18 @@
         ;;
 
 'stop') 
-        [ -n "`pgrep -x -u 0,1,$NRPE_USER nrpe`" ] && /usr/bin/kill `head -1 $pidfile`
         # remove pid file
         if [ -f "$pidfile" ]; then
-            rm "$pidfile"
-        fi
+        	[ -n "`pgrep -x -u 0,1,$NRPE_USER nrpe`" ] && /usr/bin/kill `head -1 $pidfile`
+            	rm "$pidfile"
+	else
+		if [ `uname -r` = 5.8 -o `uname -r` = 5.9 ]
+		then
+			/usr/bin/kill `pgrep -x -u 0,1,$NRPE_USER nrpe`
+		else
+			/usr/bin/kill `pgrep -x -u 0,1,$NRPE_USER -z \`zonename\` nrpe`
+		fi
+	fi
         ;;
 
 *)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list