You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2007/04/05 15:14:51 UTC

svn commit: r525817 - in /incubator/qpid/branches/M2/java/broker/bin: qpid.stop qpid.stopall

Author: ritchiem
Date: Thu Apr  5 06:14:50 2007
New Revision: 525817

URL: http://svn.apache.org/viewvc?view=rev&rev=525817
Log:
Update to qpid stop scripts to properly check for existing broker instances and promptly stop them.

Modified:
    incubator/qpid/branches/M2/java/broker/bin/qpid.stop
    incubator/qpid/branches/M2/java/broker/bin/qpid.stopall

Modified: incubator/qpid/branches/M2/java/broker/bin/qpid.stop
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/broker/bin/qpid.stop?view=diff&rev=525817&r1=525816&r2=525817
==============================================================================
--- incubator/qpid/branches/M2/java/broker/bin/qpid.stop (original)
+++ incubator/qpid/branches/M2/java/broker/bin/qpid.stop Thu Apr  5 06:14:50 2007
@@ -5,7 +5,7 @@
 # Script checks for a given pid running PROGRAM and attempts to quit it
 #
 
-MAX_ATTEMPTS=3
+MAX_ATTEMPTS=1
 SLEEP_DELAY=1
 PROGRAM="org.apache.qpid.server.Main"
 
@@ -36,26 +36,25 @@
 kill $1
 }
 
+#
+# Grep the ps log for the PID ($1) to ensure that it has quit
+#
+lookup()
+{
+result=`ps p $1 |grep -v grep |grep $PROGRAM |wc -l`
+}
 
 #
 # Sleep and then check then lookup the PID($1) to ensure it has quit
 #
 check()
 {
-echo "Waiting $SLEEP_DELAY second for $1 to exit" 
+echo "Waiting $SLEEP_DELAY second for $1 to exit"
 sleep $SLEEP_DELAY
 lookup $1
 }
 
 
-#
-# Grep the ps log for the PID ($1) to ensure that it has quit
-#
-lookup()
-{
-result=`ps p $1 |grep -v grep |grep $PROGRAM |wc -l`
-}
-
 
 #
 # Verify the PID($1) is available
@@ -71,8 +70,6 @@
 fi
 }
 
-
-
 #
 # Main Run
 #
@@ -96,7 +93,6 @@
  attempt=$[$attempt + 1]
 done
 
-
 # Check that it has quit
 if [[ $results == 0 ]] ; then
  echo "Process quit"
@@ -113,7 +109,7 @@
 
 
  # Output final status
- if [[ $attempt == $MAX_ATTEMPTS ]] ; then
+ if [[ $result > 0 && $attempt == $MAX_ATTEMPTS ]] ; then
 	echo "Stopped trying to kill process: $brokerspid"
 	echo "Attempted to stop $attempt times"
  else

Modified: incubator/qpid/branches/M2/java/broker/bin/qpid.stopall
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/broker/bin/qpid.stopall?view=diff&rev=525817&r1=525816&r2=525817
==============================================================================
--- incubator/qpid/branches/M2/java/broker/bin/qpid.stopall (original)
+++ incubator/qpid/branches/M2/java/broker/bin/qpid.stopall Thu Apr  5 06:14:50 2007
@@ -6,8 +6,6 @@
 #  Utilises qpid.stop to perform the actual stopping
 #
 
-MAX_ATTEMPTS=5
-SLEEP_DELAY=2
 PROGRAM="org.apache.qpid.server.Main"
 
 #
@@ -15,7 +13,8 @@
 #
 lookup()
 {
-pids=`ps o pid,command  |grep -v grep | grep $PROGRAM | cut -d ' ' -f 1`
+#pids=`ps o pid,command  | grep $PROGRAM | grep -v grep | cut -d ' ' -f 1`
+pids=`ps ugxwww | grep $PROGRAM | grep -v grep | awk '{print $2}'`
 result=`echo -n $pids | wc -w`
 }