Till Westmann | ea8ab39 | 2013-06-05 15:17:08 -0700 | [diff] [blame] | 1 | #/* |
Ian Maxon | 928bbd1 | 2015-09-14 17:12:48 -0700 | [diff] [blame] | 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, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 18 | # Licensed to the Apache Software Foundation (ASF) under one or more |
| 19 | # contributor license agreements. See the NOTICE file distributed with |
| 20 | # this work for additional information regarding copyright ownership. |
| 21 | # The ASF licenses this file to You under the Apache License, Version 2.0 |
| 22 | # (the "License"); you may not use this file except in compliance with |
| 23 | # the License. You may obtain a copy of the License at |
| 24 | # |
| 25 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 26 | # |
| 27 | # Unless required by applicable law or agreed to in writing, software |
| 28 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 29 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 30 | # See the License for the specific language governing permissions and |
| 31 | # limitations under the License. |
| 32 | |
| 33 | # included in all the hadoop scripts with source command |
| 34 | # should not be executable directly |
| 35 | # also should not be passed any arguments, since we need original $* |
| 36 | |
| 37 | # resolve links - $0 may be a softlink |
| 38 | |
| 39 | this="$0" |
| 40 | while [ -h "$this" ]; do |
| 41 | ls=`ls -ld "$this"` |
| 42 | link=`expr "$ls" : '.*-> \(.*\)$'` |
| 43 | if expr "$link" : '.*/.*' > /dev/null; then |
| 44 | this="$link" |
| 45 | else |
| 46 | this=`dirname "$this"`/"$link" |
| 47 | fi |
| 48 | done |
| 49 | |
| 50 | # convert relative path to absolute path |
| 51 | bin=`dirname "$this"` |
| 52 | script=`basename "$this"` |
| 53 | bin=`cd "$bin"; pwd` |
| 54 | this="$bin/$script" |
| 55 | |
| 56 | # the root of the Hadoop installation |
| 57 | export HADOOP_HOME=`dirname "$this"`/.. |
| 58 | |
| 59 | #check to see if the conf dir is given as an optional argument |
| 60 | if [ $# -gt 1 ] |
| 61 | then |
| 62 | if [ "--config" = "$1" ] |
| 63 | then |
| 64 | shift |
| 65 | confdir=$1 |
| 66 | shift |
| 67 | HADOOP_CONF_DIR=$confdir |
| 68 | fi |
| 69 | fi |
| 70 | |
| 71 | # Allow alternate conf dir location. |
| 72 | HADOOP_CONF_DIR="${HADOOP_CONF_DIR:-$HADOOP_HOME/conf}" |
| 73 | |
| 74 | #check to see it is specified whether to use the slaves or the |
| 75 | # masters file |
| 76 | if [ $# -gt 1 ] |
| 77 | then |
| 78 | if [ "--hosts" = "$1" ] |
| 79 | then |
| 80 | shift |
| 81 | slavesfile=$1 |
| 82 | shift |
| 83 | export HADOOP_SLAVES="${HADOOP_CONF_DIR}/$slavesfile" |
| 84 | fi |
| 85 | fi |