PageRenderTime 37ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 1ms

/tags/release-0.2.0-rc0/bin/hcat

#
#! | 79 lines | 67 code | 12 blank | 0 comment | 0 complexity | a395979b17ec8b38f9fa9e93a9e5e2c4 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. # Resolve our absolute path
  18. # resolve links - $0 may be a softlink
  19. this="${BASH_SOURCE-$0}"
  20. while [ -h "$this" ]; do
  21. ls=`ls -ld "$this"`
  22. link=`expr "$ls" : '.*-> \(.*\)$'`
  23. if expr "$link" : '.*/.*' > /dev/null; then
  24. this="$link"
  25. else
  26. this=`dirname "$this"`/"$link"
  27. fi
  28. done
  29. # convert relative path to absolute path
  30. bin=`dirname "$this"`
  31. script=`basename "$this"`
  32. bin=`unset CDPATH; cd "$bin"; pwd`
  33. this="$bin/$script"
  34. if [ -e "$bin/../libexec/hcat-config.sh" ]; then
  35. . "$bin"/../libexec/hcat-config.sh
  36. else
  37. . "$bin"/hcat-config.sh
  38. fi
  39. # filter debug command line parameter
  40. debug=false
  41. for f in $@; do
  42. if [[ $f = "-secretDebugCmd" ]]; then
  43. debug=true
  44. else
  45. remaining="${remaining} $f"
  46. fi
  47. done
  48. # Find our hcatalog jar
  49. shopt -s extglob
  50. HCAT_JAR=$HCAT_PREFIX/share/hcatalog/hcatalog-!(*server-extensions*).jar
  51. # Add all of the other jars to our classpath
  52. for jar in $HCAT_PREFIX/share/hcatalog/lib/*.jar ; do
  53. HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$jar
  54. done
  55. # Put our config file in the classpath
  56. HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${HCAT_PREFIX}/etc/hcatalog
  57. export HADOOP_CLASSPATH=$HADOOP_CLASSPATH
  58. export HADOOP_OPTS=$HADOOP_OPTS
  59. # run it
  60. if [ "$debug" == "true" ]; then
  61. echo "Would run:"
  62. echo "exec $HADOOP_PREFIX/bin/hadoop jar $HCAT_JAR org.apache.hcatalog.cli.HCatCli $remaining"
  63. echo "with HADOOP_CLASSPATH set to ($HADOOP_CLASSPATH)"
  64. echo "and HADOOP_OPTS set to ($HADOOP_OPTS)"
  65. else
  66. exec $HADOOP_PREFIX/bin/hadoop jar $HCAT_JAR org.apache.hcatalog.cli.HCatCli "$@"
  67. fi