source: proiecte/HadoopJUnit/hadoop-0.20.1/src/contrib/hdfsproxy/bin/hdfsproxy @ 176

Last change on this file since 176 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 5.0 KB
Line 
1#!/usr/bin/env bash
2
3# Licensed to the Apache Software Foundation (ASF) under one or more
4# contributor license agreements.  See the NOTICE file distributed with
5# this work for additional information regarding copyright ownership.
6# The ASF licenses this file to You under the Apache License, Version 2.0
7# (the "License"); you may not use this file except in compliance with
8# 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
18
19# The HdfsProxy command script
20#
21# Environment Variables
22#
23#   JAVA_HOME        The java implementation to use.  Overrides JAVA_HOME.
24#
25#   HDFSPROXY_CLASSPATH Extra Java CLASSPATH entries.
26#
27#   HDFSPROXY_HEAPSIZE  The maximum amount of heap to use, in MB.
28#                    Default is 1000.
29#
30#   HDFSPROXY_OPTS      Extra Java runtime options.
31#   
32#   HDFSPROXY_NAMENODE_OPTS       These options are added to HDFSPROXY_OPTS
33#   HDFSPROXY_CLIENT_OPTS         when the respective command is run.
34#   HDFSPROXY_{COMMAND}_OPTS etc  HDFSPROXY_JT_OPTS applies to JobTracker
35#                              for e.g.  HDFSPROXY_CLIENT_OPTS applies to
36#                              more than one command (fs, dfs, fsck,
37#                              dfsadmin etc) 
38#
39#   HDFSPROXY_CONF_DIR  Alternate conf dir. Default is ${HDFSPROXY_HOME}/conf.
40#
41#   HDFSPROXY_ROOT_LOGGER The root appender. Default is INFO,console
42#
43
44bin=`dirname "$0"`
45bin=`cd "$bin"; pwd`
46
47. "$bin"/hdfsproxy-config.sh
48
49cygwin=false
50case "`uname`" in
51CYGWIN*) cygwin=true;;
52esac
53
54if [ -f "${HDFSPROXY_CONF_DIR}/hdfsproxy-env.sh" ]; then
55  . "${HDFSPROXY_CONF_DIR}/hdfsproxy-env.sh"
56fi
57
58# some Java parameters
59if [ "$JAVA_HOME" != "" ]; then
60  #echo "run java in $JAVA_HOME"
61  JAVA_HOME=$JAVA_HOME
62fi
63 
64if [ "$JAVA_HOME" = "" ]; then
65  echo "Error: JAVA_HOME is not set."
66  exit 1
67fi
68
69JAVA=$JAVA_HOME/bin/java
70JAVA_HEAP_MAX=-Xmx1000m
71
72# check envvars which might override default args
73if [ "$HDFSPROXY_HEAPSIZE" != "" ]; then
74  #echo "run with heapsize $HDFSPROXY_HEAPSIZE"
75  JAVA_HEAP_MAX="-Xmx""$HDFSPROXY_HEAPSIZE""m"
76  #echo $JAVA_HEAP_MAX
77fi
78
79# CLASSPATH initially contains $HDFSPROXY_CONF_DIR
80CLASSPATH="${HDFSPROXY_CONF_DIR}"
81CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
82
83# for developers, add HdfsProxy classes to CLASSPATH
84if [ -d "$HDFSPROXY_HOME/build/classes" ]; then
85  CLASSPATH=${CLASSPATH}:$HDFSPROXY_HOME/build/classes
86fi
87if [ -d "$HDFSPROXY_HOME/build/webapps" ]; then
88  CLASSPATH=${CLASSPATH}:$HDFSPROXY_HOME/build
89fi
90if [ -d "$HDFSPROXY_HOME/build/test/classes" ]; then
91  CLASSPATH=${CLASSPATH}:$HDFSPROXY_HOME/build/test/classes
92fi
93
94# so that filenames w/ spaces are handled correctly in loops below
95IFS=
96
97# for releases, add hdfsproxy jar & webapps to CLASSPATH
98if [ -d "$HDFSPROXY_HOME/webapps" ]; then
99  CLASSPATH=${CLASSPATH}:$HDFSPROXY_HOME
100fi
101for f in $HDFSPROXY_HOME/hdfsproxy-*.jar; do
102  CLASSPATH=${CLASSPATH}:$f;
103done
104
105# add libs to CLASSPATH
106if [ -d "$HDFSPROXY_HOME/lib" ]; then
107        for f in $HDFSPROXY_HOME/lib/*.jar; do
108          CLASSPATH=${CLASSPATH}:$f;
109        done
110fi
111
112if [ -d "$HDFSPROXY_HOME/../../" ]; then
113        for f in $HDFSPROXY_HOME/../../*.jar; do
114    CLASSPATH=${CLASSPATH}:$f;
115  done
116fi
117if [ -d "$HDFSPROXY_HOME/../../lib" ]; then
118        for f in $HDFSPROXY_HOME/../../lib/*.jar; do
119    CLASSPATH=${CLASSPATH}:$f;
120  done
121fi
122if [ -d "$HDFSPROXY_HOME/../../lib/jsp-2.1" ]; then
123        for f in $HDFSPROXY_HOME/../../lib/jsp-2.1/*.jar; do
124    CLASSPATH=${CLASSPATH}:$f;
125  done
126fi
127
128
129# add user-specified CLASSPATH last
130if [ "$HDFSPROXY_CLASSPATH" != "" ]; then
131  CLASSPATH=${CLASSPATH}:${HDFSPROXY_CLASSPATH}
132fi
133
134# default log directory & file
135if [ "$HDFSPROXY_LOG_DIR" = "" ]; then
136  HDFSPROXY_LOG_DIR="$HDFSPROXY_HOME/logs"
137fi
138if [ "$HDFSPROXY_LOGFILE" = "" ]; then
139  HDFSPROXY_LOGFILE='hdfsproxy.log'
140fi
141
142# restore ordinary behaviour
143unset IFS
144
145# figure out which class to run
146CLASS='org.apache.hadoop.hdfsproxy.HdfsProxy'
147
148# cygwin path translation
149if $cygwin; then
150  CLASSPATH=`cygpath -p -w "$CLASSPATH"`
151  HDFSPROXY_HOME=`cygpath -d "$HDFSPROXY_HOME"`
152  HDFSPROXY_LOG_DIR=`cygpath -d "$HDFSPROXY_LOG_DIR"`
153fi
154
155# cygwin path translation
156if $cygwin; then
157  JAVA_LIBRARY_PATH=`cygpath -p "$JAVA_LIBRARY_PATH"`
158fi
159
160HDFSPROXY_OPTS="$HDFSPROXY_OPTS -Dhdfsproxy.log.dir=$HDFSPROXY_LOG_DIR"
161HDFSPROXY_OPTS="$HDFSPROXY_OPTS -Dhdfsproxy.log.file=$HDFSPROXY_LOGFILE"
162HDFSPROXY_OPTS="$HDFSPROXY_OPTS -Dhdfsproxy.home.dir=$HDFSPROXY_HOME"
163HDFSPROXY_OPTS="$HDFSPROXY_OPTS -Dhdfsproxy.id.str=$HDFSPROXY_IDENT_STRING"
164HDFSPROXY_OPTS="$HDFSPROXY_OPTS -Dhdfsproxy.root.logger=${HDFSPROXY_ROOT_LOGGER:-INFO,console}"
165if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
166  HDFSPROXY_OPTS="$HDFSPROXY_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
167fi 
168
169# run it
170exec "$JAVA" $JAVA_HEAP_MAX $HDFSPROXY_OPTS -classpath "$CLASSPATH" $CLASS "$@"
Note: See TracBrowser for help on using the repository browser.