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/081bf87d Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/081bf87d Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/081bf87d Branch: refs/heads/1.4-rc Commit: 081bf87dcdf9eef91f0594b34335abbef94baad7 Parents: aa86b31 Author: lidongsjtu <lid...@apache.org> Authored: Wed Feb 24 15:42:52 2016 +0800 Committer: lidongsjtu <lid...@apache.org> Committed: Tue Mar 8 12:08:23 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/081bf87d/build/bin/find-hive-dependency.sh ---------------------------------------------------------------------- diff --git a/build/bin/find-hive-dependency.sh b/build/bin/find-hive-dependency.sh index 47f0fbc..55ee047 100644 --- a/build/bin/find-hive-dependency.sh +++ b/build/bin/find-hive-dependency.sh @@ -23,6 +23,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'` @@ -30,13 +37,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