hadoop-config.sh 866 B

123456789101112131415161718192021222324252627282930313233343536
  1. # included in all the hadoop scripts with source command
  2. # should not be executable directly
  3. # also should not be passed any arguments, since we need original $*
  4. # resolve links - $0 may be a softlink
  5. bin=`dirname "$0"`
  6. script=`basename "$0"`
  7. bin=`cd "$bin"; pwd`
  8. this="$bin/$script"
  9. while [ -h "$this" ]; do
  10. ls=`ls -ld "$this"`
  11. link=`expr "$ls" : '.*-> \(.*\)$'`
  12. if expr "$link" : '.*/.*' > /dev/null; then
  13. this="$link"
  14. else
  15. this=`dirname "$this"`/"$link"
  16. fi
  17. done
  18. # the root of the Hadoop installation
  19. export HADOOP_HOME=`dirname "$this"`/..
  20. #check to see if the conf dir is given as an optional argument
  21. if [ $# -gt 1 ]
  22. then
  23. if [ "--config" = "$1" ]
  24. then
  25. shift
  26. confdir=$1
  27. shift
  28. HADOOP_CONF_DIR=$confdir
  29. fi
  30. fi
  31. # Allow alternate conf dir location.
  32. HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-$HADOOP_HOME/conf}"