From 3df14afe7b02d5cffe88f66ea5751a3ab41d81a9 Mon Sep 17 00:00:00 2001 From: etherge Date: Sat, 5 Nov 2016 21:32:55 +0800 Subject: [PATCH] minor, use -v opt instead of env variable for kylin.sh --- build/bin/header.sh | 14 ++++++++++++++ build/bin/kylin.sh | 8 +++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/build/bin/header.sh b/build/bin/header.sh index 949ea95..8a6fc00 100644 --- a/build/bin/header.sh +++ b/build/bin/header.sh @@ -19,6 +19,20 @@ # source me +verbose=${verbose:-""} + +while getopts ":v" opt; do + case $opt in + v) + echo "Turn on verbose mode." >&2 + verbose=true + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac +done + if [[ "$dir" == "" ]] then dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) diff --git a/build/bin/kylin.sh b/build/bin/kylin.sh index f45c1dd..dedb552 100644 --- a/build/bin/kylin.sh +++ b/build/bin/kylin.sh @@ -18,9 +18,11 @@ # # set verbose=true to print more logs during start up -verbose=${verbose:-""} -source $(cd -P -- "$(dirname -- "$0")" && pwd -P)/header.sh +source $(cd -P -- "$(dirname -- "$0")" && pwd -P)/header.sh $@ +if [ "$verbose" = true ]; then + shift +fi source ${dir}/check-env.sh mkdir -p ${KYLIN_HOME}/logs @@ -162,5 +164,5 @@ then exec hbase ${KYLIN_EXTRA_START_OPTS} -Dkylin.hive.dependency=${hive_dependency} -Dkylin.hbase.dependency=${hbase_dependency} -Dlog4j.configuration=kylin-log4j.properties "$@" else - quit "Usage: 'kylin.sh start' or 'kylin.sh stop'" + quit "Usage: 'kylin.sh [-v] start' or 'kylin.sh [-v] stop'" fi -- 2.7.4 (Apple Git-66)