tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jh...@apache.org
Subject tajo git commit: TAJO-1828: tajo-daemon scripts should kill process after process can not stop gracefully.
Date Wed, 09 Sep 2015 03:37:01 GMT
Repository: tajo
Updated Branches:
  refs/heads/master bdd8e7685 -> c66d0b470


TAJO-1828: tajo-daemon scripts should kill process after process can not stop gracefully.

Closes #746


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

Branch: refs/heads/master
Commit: c66d0b4708814ed8f7a1ae530338e1fcf87caddc
Parents: bdd8e76
Author: Jinho Kim <jhkim@apache.org>
Authored: Wed Sep 9 12:35:02 2015 +0900
Committer: Jinho Kim <jhkim@apache.org>
Committed: Wed Sep 9 12:36:36 2015 +0900

----------------------------------------------------------------------
 CHANGES                               |  3 +++
 tajo-dist/src/main/bin/tajo-daemon.sh | 12 ++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/c66d0b47/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 52d1ca5..a704b86 100644
--- a/CHANGES
+++ b/CHANGES
@@ -36,6 +36,9 @@ Release 0.11.0 - unreleased
 
   IMPROVEMENT
 
+    TAJO-1828: tajo-daemon scripts should kill process after process can not 
+    stop gracefully. (jinho)
+
     TAJO-1729: No handling of default case in DDLExecutor.
     (Contributed by Dongkyu Hwangbo. Committed by jinho)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/c66d0b47/tajo-dist/src/main/bin/tajo-daemon.sh
----------------------------------------------------------------------
diff --git a/tajo-dist/src/main/bin/tajo-daemon.sh b/tajo-dist/src/main/bin/tajo-daemon.sh
index 48790e9..6343df7 100755
--- a/tajo-dist/src/main/bin/tajo-daemon.sh
+++ b/tajo-dist/src/main/bin/tajo-daemon.sh
@@ -95,6 +95,7 @@ fi
 export TAJO_LOGFILE=tajo-$TAJO_IDENT_STRING-$command-$HOSTNAME.log
 export TAJO_ROOT_LOGGER_APPENDER="${TAJO_ROOT_LOGGER_APPENDER:-DRFA}"
 export TAJO_PULLSERVER_STANDALONE="${TAJO_PULLSERVER_STANDALONE:-false}"
+export TAJO_STOP_TIMEOUT=${TAJO_STOP_TIMEOUT:-2}
 log=$TAJO_LOG_DIR/tajo-$TAJO_IDENT_STRING-$command-$HOSTNAME.out
 pid=$TAJO_PID_DIR/tajo-$TAJO_IDENT_STRING-$command.pid
 
@@ -132,12 +133,19 @@ case $startStop in
   (stop)
 
     if [ -f $pid ]; then
-      if kill -0 `cat $pid` > /dev/null 2>&1; then
+      TARGET_PID=`cat $pid`
+      if kill -0 $TARGET_PID > /dev/null 2>&1; then
         echo stopping $command
-        kill `cat $pid`
+        kill $TARGET_PID
+        sleep $TAJO_STOP_TIMEOUT
+        if kill -0 $TARGET_PID > /dev/null 2>&1; then
+          echo "$command did not stop gracefully after $TAJO_STOP_TIMEOUT seconds: killing
with kill -9"
+          kill -9 $TARGET_PID
+        fi
       else
         echo no $command to stop
       fi
+      rm -f $pid
     else
       echo no $command to stop
     fi


Mime
View raw message