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/513ec2d3 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/513ec2d3 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/513ec2d3 Branch: refs/heads/1.x-staging Commit: 513ec2d32e029aa05cb00cc2f79ecf9673cf6c1e Parents: f4bd22a Author: lidongsjtu <lid...@apache.org> Authored: Wed Feb 24 15:42:52 2016 +0800 Committer: lidongsjtu <lid...@apache.org> Committed: Thu Feb 25 13:53:21 2016 +0800 ---------------------------------------------------------------------- bin/find-hive-dependency.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/513ec2d3/bin/find-hive-dependency.sh ---------------------------------------------------------------------- diff --git a/bin/find-hive-dependency.sh b/bin/find-hive-dependency.sh index 7e434ba..add7d23 100755 --- a/bin/find-hive-dependency.sh +++ b/bin/find-hive-dependency.sh @@ -33,6 +33,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'` @@ -40,13 +47,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