KYLIN-1445 Check HIVE_CONF directory before startup Kylin instance
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/4d6043f1 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/4d6043f1 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/4d6043f1 Branch: refs/heads/master Commit: 4d6043f1c66a358f3c5e57e9cb14861401f09b28 Parents: 9c77a5e Author: lidongsjtu <lid...@apache.org> Authored: Wed Feb 24 15:42:52 2016 +0800 Committer: lidongsjtu <lid...@apache.org> Committed: Mon Feb 29 19:27:13 2016 +0800 ---------------------------------------------------------------------- build/bin/find-hive-dependency.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/4d6043f1/build/bin/find-hive-dependency.sh ---------------------------------------------------------------------- diff --git a/build/bin/find-hive-dependency.sh b/build/bin/find-hive-dependency.sh index 171c5b1..87f18dd 100644 --- a/build/bin/find-hive-dependency.sh +++ b/build/bin/find-hive-dependency.sh @@ -32,6 +32,13 @@ hive_classpath=`echo $hive_env | grep 'env:CLASSPATH' | awk -F '=' '{print $2}'` arr=(`echo $hive_classpath | cut -d ":" --output-delimiter=" " -f 1-`) hive_conf_path= hive_exec_path= + +if [ -n "$HIVE_CONF" ] +then + echo "HIVE_CONF is set to: $HIVE_CONF, use it to locate hive configurations." + hive_conf_path=$HIVE_CONF +fi + for data in ${arr[@]} do result=`echo $data | grep -e 'hive-exec[a-z0-9A-Z\.-]*jar'` @@ -39,13 +46,24 @@ do then hive_exec_path=$data fi - result=`echo $data | grep -e 'hive[^/]*/conf'` - if [ $result ] + + # in some versions of hive config is not in hive's classpath, find it separately + if [ -z "$hive_conf_path" ] then - hive_conf_path=$data + result=`echo $data | grep -e 'hive[^/]*/conf'` + if [ $result ] + then + hive_conf_path=$data + fi fi done +if [ -z "$hive_conf_path" ] +then + echo "Couldn't find hive configuration directory. Please set HIVE_CONF to the path which contains hive-site.xml." + exit 1 +fi + # in some versions of hive hcatalog is not in hive's classpath, find it separately if [ -z "$HCAT_HOME" ] then