From 70036a3ac7d3380d559a95921b1092c81e2c23cd Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Thu, 5 Apr 2007 13:50:56 +0000 Subject: Updated scripts to work correctly under solaris and bash 2.0 git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@525829 13f79535-47bb-0310-9956-ffa450edef68 --- java/broker/bin/qpid.stop | 17 +++++++++-------- java/broker/bin/qpid.stopall | 10 +++++----- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'java') diff --git a/java/broker/bin/qpid.stop b/java/broker/bin/qpid.stop index f3711d4c8e..9193d3c4e1 100644 --- a/java/broker/bin/qpid.stop +++ b/java/broker/bin/qpid.stop @@ -7,7 +7,7 @@ MAX_ATTEMPTS=1 SLEEP_DELAY=1 -PROGRAM="org.apache.qpid.server.Main" +PROGRAM="DQPID" # @@ -15,7 +15,8 @@ PROGRAM="org.apache.qpid.server.Main" # printActions() { -ps=`ps o command p $1|grep $PROGRAM` +#ps=`ps o command p $1|grep $PROGRAM` +ps=`ps -o args -p $1|grep $PROGRAM` echo "Attempting to kill: $ps" } @@ -41,7 +42,7 @@ kill $1 # lookup() { -result=`ps p $1 |grep -v grep |grep $PROGRAM |wc -l` +result=`ps -o args -p $1 |grep -v grep |grep $PROGRAM |wc -l` } # @@ -62,7 +63,7 @@ lookup $1 verifyPid() { lookup $1 -if [[ $result == 1 ]] ; then +if [[ $[$result] == 1 ]] ; then brokerspid=$1 else echo "Unable to locate Qpid Process with PID $1" @@ -87,21 +88,21 @@ printActions $brokerspid # Attempt to quit the process MAX_ATTEMPTS Times attempt=0 -while [[ $result > 0 && $attempt < $MAX_ATTEMPTS ]] ; do +while [[ $[$result] > 0 && $[$attempt] < $[$MAX_ATTEMPTS] ]] ; do quit $brokerspid check $brokerspid attempt=$[$attempt + 1] done # Check that it has quit -if [[ $results == 0 ]] ; then +if [[ $[$result] == 0 ]] ; then echo "Process quit" exit 0 else # Now attempt to force quit the process attempt=0 - while [[ $result > 0 && $attempt < $MAX_ATTEMPTS ]] ; do + while [[ $[$result] > 0 && $[$attempt] < $[$MAX_ATTEMPTS] ]] ; do forceQuit $brokerspid check $brokerspid attempt=$[$attempt + 1] @@ -109,7 +110,7 @@ else # Output final status - if [[ $result > 0 && $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 diff --git a/java/broker/bin/qpid.stopall b/java/broker/bin/qpid.stopall index 8705825064..2e762bdd50 100644 --- a/java/broker/bin/qpid.stopall +++ b/java/broker/bin/qpid.stopall @@ -6,7 +6,7 @@ # Utilises qpid.stop to perform the actual stopping # -PROGRAM="org.apache.qpid.server.Main" +PROGRAM="DQPID" # # grep ps for instances of $PROGRAM and collect PIDs @@ -14,7 +14,7 @@ PROGRAM="org.apache.qpid.server.Main" lookup() { #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}'` +pids=`ps -ef |grep $USER | grep $PROGRAM | grep -v grep | awk '{print $2}'` result=`echo -n $pids | wc -w` } @@ -24,7 +24,7 @@ result=`echo -n $pids | wc -w` # showPids() { -ps p $pids +ps -o user,pid,args -p $pids } @@ -34,7 +34,7 @@ ps p $pids lookup -if [[ $result == 0 ]] ; then +if [[ $[$result] == 0 ]] ; then echo "No Qpid Brokers found running under user '$USER'" exit 0 fi @@ -48,7 +48,7 @@ done # Check we have quit all lookup -if [[ $result == 0 ]] ; then +if [[ $[$result] == 0 ]] ; then echo "All Qpid brokers successfully quit" else echo "Some brokers were not quit" -- cgit v1.2.1