blob: 56b019e0180363aee916115084db7e80906e1c91 [file] [log] [blame]
Till Westmannea8ab392013-06-05 15:17:08 -07001#/*
Ian Maxon928bbd12015-09-14 17:12:48 -07002# 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.
ramangrover29116eb972013-02-20 20:47:35 +000018# 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
39this="$0"
40while [ -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
48done
49
50# convert relative path to absolute path
51bin=`dirname "$this"`
52script=`basename "$this"`
53bin=`cd "$bin"; pwd`
54this="$bin/$script"
55
56# the root of the Hadoop installation
57export HADOOP_HOME=`dirname "$this"`/..
58
59#check to see if the conf dir is given as an optional argument
60if [ $# -gt 1 ]
61then
62 if [ "--config" = "$1" ]
63 then
64 shift
65 confdir=$1
66 shift
67 HADOOP_CONF_DIR=$confdir
68 fi
69fi
70
71# Allow alternate conf dir location.
72HADOOP_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
76if [ $# -gt 1 ]
77then
78 if [ "--hosts" = "$1" ]
79 then
80 shift
81 slavesfile=$1
82 shift
83 export HADOOP_SLAVES="${HADOOP_CONF_DIR}/$slavesfile"
84 fi
85fi