Repository: tajo Updated Branches: refs/heads/branch-0.11.0 7b27c8ce9 -> dd7adfcc6
TAJO-1828: tajo-daemon scripts should kill process after process can not stop gracefully. Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/dd7adfcc Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/dd7adfcc Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/dd7adfcc Branch: refs/heads/branch-0.11.0 Commit: dd7adfcc6cef4058d6fa3fb453c4c2e420081d16 Parents: 7b27c8c Author: Jinho Kim <[email protected]> Authored: Wed Sep 9 12:41:01 2015 +0900 Committer: Jinho Kim <[email protected]> Committed: Wed Sep 9 12:41:01 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/dd7adfcc/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 0d4f71d..d8c3fd2 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/dd7adfcc/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
