From 90688bde9b1172fb2a042905dba645fbeda92510 Mon Sep 17 00:00:00 2001 From: Rui Li Date: Fri, 17 Feb 2017 11:08:40 +0800 Subject: [PATCH] HIVE-15710: HS2 Stopped when running in background (Rui reviewed by Ferdinand, Xuefu and Mohit) --- bin/beeline | 5 ----- bin/ext/cli.sh | 8 -------- bin/hive | 7 +++++++ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/bin/beeline b/bin/beeline index 7b974d4fba19..d247c39813dc 100644 --- a/bin/beeline +++ b/bin/beeline @@ -18,9 +18,4 @@ bin=`dirname "$0"` bin=`cd "$bin"; pwd` -# If process is backgrounded, don't change terminal settings -if [[ ( ! $(ps -o stat= -p $$) =~ "+" ) && ! ( -p /dev/stdin ) ]]; then - export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Djline.terminal=jline.UnsupportedTerminal" -fi - . "$bin"/hive --service beeline "$@" diff --git a/bin/ext/cli.sh b/bin/ext/cli.sh index 4933c2e46c84..87329f3c5121 100644 --- a/bin/ext/cli.sh +++ b/bin/ext/cli.sh @@ -22,13 +22,6 @@ if [ -z "$USE_DEPRECATED_CLI" ] || [ "$USE_DEPRECATED_CLI" != "false" ]; then USE_DEPRECATED_CLI="true" fi -updateBeelineOpts() { - # If process is backgrounded, don't change terminal settings - if [[ ( ! $(ps -o stat= -p $$) =~ *+ ) && ! ( -p /dev/stdin ) ]]; then - export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Djline.terminal=jline.UnsupportedTerminal" - fi -} - updateCli() { if [ "$USE_DEPRECATED_CLI" == "true" ]; then CLASS=org.apache.hadoop.hive.cli.CliDriver @@ -37,7 +30,6 @@ updateCli() { export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dlog4j.configurationFile=beeline-log4j2.properties" CLASS=org.apache.hive.beeline.cli.HiveCli JAR=hive-beeline-*.jar - updateBeelineOpts fi } diff --git a/bin/hive b/bin/hive index 50fbdddd5f60..e1ee206a4c9c 100755 --- a/bin/hive +++ b/bin/hive @@ -344,6 +344,13 @@ else export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dlog4j.configurationFile=hive-log4j2.properties -Djava.util.logging.config.file=$bin/../conf/parquet-logging.properties " fi +if [[ "$SERVICE" =~ ^(hiveserver2|beeline|cli)$ ]] ; then + # If process is backgrounded, don't change terminal settings + if [[ ( ! $(ps -o stat= -p $$) =~ "+" ) && ! ( -p /dev/stdin ) ]]; then + export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Djline.terminal=jline.UnsupportedTerminal" + fi +fi + if [ "$TORUN" = "" ] ; then echo "Service $SERVICE not found" echo "Available Services: $SERVICE_LIST"