diff options
| author | Martin Ritchie <ritchiem@apache.org> | 2007-04-05 13:14:50 +0000 |
|---|---|---|
| committer | Martin Ritchie <ritchiem@apache.org> | 2007-04-05 13:14:50 +0000 |
| commit | c7950f3d513fadc6375c92ef2f61d44d3688c7a0 (patch) | |
| tree | ae293b0a962db48fd3dacc21ab540652764f173b /java/broker/bin | |
| parent | b5ccce73d4e874ae1c44c92b4f9b2660d6fb5edb (diff) | |
| download | qpid-python-c7950f3d513fadc6375c92ef2f61d44d3688c7a0.tar.gz | |
Update to qpid stop scripts to properly check for existing broker instances and promptly stop them.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@525817 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker/bin')
| -rw-r--r-- | java/broker/bin/qpid.stop | 24 | ||||
| -rw-r--r-- | java/broker/bin/qpid.stopall | 5 |
2 files changed, 12 insertions, 17 deletions
diff --git a/java/broker/bin/qpid.stop b/java/broker/bin/qpid.stop index cc8c23b3e4..f3711d4c8e 100644 --- a/java/broker/bin/qpid.stop +++ b/java/broker/bin/qpid.stop @@ -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 @@ quit() 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 @@ else fi } - - # # Main Run # @@ -96,7 +93,6 @@ while [[ $result > 0 && $attempt < $MAX_ATTEMPTS ]] ; do attempt=$[$attempt + 1] done - # Check that it has quit if [[ $results == 0 ]] ; then echo "Process quit" @@ -113,7 +109,7 @@ else # 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 diff --git a/java/broker/bin/qpid.stopall b/java/broker/bin/qpid.stopall index 06d05b1fdc..8705825064 100644 --- a/java/broker/bin/qpid.stopall +++ b/java/broker/bin/qpid.stopall @@ -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 @@ PROGRAM="org.apache.qpid.server.Main" # 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` } |
