asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject asterixdb git commit: [ASTERIXDB-2032]Let stop-sample-cluster.sh to kill processes.
Date Mon, 14 Aug 2017 15:19:37 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 60f89981d -> 122a73693


[ASTERIXDB-2032]Let stop-sample-cluster.sh to kill processes.

Change-Id: I44d75e518cca604273790aa1d862ca5764fa6395
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1933
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/122a7369
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/122a7369
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/122a7369

Branch: refs/heads/master
Commit: 122a73693e4a6a2484936ed86967e843d4dfa4e1
Parents: 60f8998
Author: Yingyi Bu <yingyi@couchbase.com>
Authored: Fri Aug 11 11:32:30 2017 -0700
Committer: Yingyi Bu <buyingyi@gmail.com>
Committed: Mon Aug 14 08:19:17 2017 -0700

----------------------------------------------------------------------
 .../main/opt/local/bin/stop-sample-cluster.sh   | 23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/122a7369/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh
index dbce377..f33f403 100755
--- a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.sh
@@ -25,6 +25,16 @@ function usage() {
   echo "  -f[orce]  : Forcibly terminates any running ${PRODUCT} processes (after shutting
down cluster, if running)"
 }
 
+function kill_procs() {
+  cat /tmp/$$_pids | while read line; do
+    if [ $minus_nine ]; then
+       echo $line | awk '{ print $2 }' | xargs -n1 kill -9
+    else
+       echo $line | awk '{ print $2 }' | xargs -n1 kill
+    fi
+  done
+}
+
 while [ -n "$1" ]; do
   case $1 in
     -f|-force) force=1;;
@@ -58,7 +68,10 @@ CLUSTERDIR=$(cd "$DIRNAME/.."; echo $PWD)
 INSTALLDIR=$(cd "$CLUSTERDIR/../.."; echo $PWD)
 "$INSTALLDIR/bin/${HELPER_COMMAND}" get_cluster_state -quiet
 if [ $? -ne 1 ]; then
-  "$INSTALLDIR/bin/${HELPER_COMMAND}" shutdown_cluster_all
+  if ps -ef | grep 'java.*org\.apache\.hyracks\.control\.[cn]c\.\([CN]CDriver\|service\.NCService\)'
> /tmp/$$_pids; then
+    minus_nine=0;
+    kill_procs;
+  fi
   first=1
   tries=0
   echo -n "INFO: Waiting up to 60s for cluster to shutdown"
@@ -79,12 +92,8 @@ fi
 if ps -ef | grep 'java.*org\.apache\.hyracks\.control\.[cn]c\.\([CN]CDriver\|service\.NCService\)'
> /tmp/$$_pids; then
   echo -n "WARNING: ${PRODUCT} processes remain after cluster shutdown; "
   if [ $force ]; then
-    echo "-f[orce] specified, forcibly terminating ${PRODUCT} processes:"
-    cat /tmp/$$_pids | while read line; do
-      echo -n "   - $line..."
-      echo $line | awk '{ print $2 }' | xargs -n1 kill -9
-      echo "killed"
-    done
+    minus_nine=1;
+    kill_procs;
   else
     echo "re-run with -f|-force to forcibly terminate all ${PRODUCT} processes:"
     cat /tmp/pids |  sed 's/^ *[0-9]* \([0-9]*\).*org\.apache\.hyracks\.control\.[cn]c[^
]*\.\([^ ]*\) .*/\1 - \2/'


Mime
View raw message