You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2013/09/11 15:00:42 UTC
git commit: ACCUMULO-1707 applying Steve's patch
Updated Branches:
refs/heads/1.5.1-SNAPSHOT 47373244d -> b15452301
ACCUMULO-1707 applying Steve's patch
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/b1545230
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/b1545230
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/b1545230
Branch: refs/heads/1.5.1-SNAPSHOT
Commit: b15452301c8f98930ee23faf70acaafb0149ec3e
Parents: 4737324
Author: Eric Newton <er...@gmail.com>
Authored: Wed Sep 11 08:57:49 2013 -0400
Committer: Eric Newton <er...@gmail.com>
Committed: Wed Sep 11 08:57:49 2013 -0400
----------------------------------------------------------------------
bin/accumulo | 71 +++++++++++++++++++++++++++----------------------------
1 file changed, 35 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b1545230/bin/accumulo
----------------------------------------------------------------------
diff --git a/bin/accumulo b/bin/accumulo
index 3ae3095..d96c474 100755
--- a/bin/accumulo
+++ b/bin/accumulo
@@ -17,18 +17,18 @@
# Start: Resolve Script Directory
SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
- bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
- SOURCE="$(readlink "$SOURCE")"
- [[ $SOURCE != /* ]] && SOURCE="$bin/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+while [ -h "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink
+ bin="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+ SOURCE="$(readlink "${SOURCE}")"
+ [[ "${SOURCE}" != /* ]] && SOURCE="${bin}/${SOURCE}" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
-bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
-script=$( basename "$SOURCE" )
+bin="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
-. "$bin"/config.sh
+. "${bin}"/config.sh
-START_JAR=$ACCUMULO_HOME/lib/accumulo-start.jar
+START_JAR="${ACCUMULO_HOME}/lib/accumulo-start.jar"
#
# Resolve a program to its installation directory
@@ -36,25 +36,24 @@ START_JAR=$ACCUMULO_HOME/lib/accumulo-start.jar
locationByProgram()
{
RESULT=$( which "$1" )
- if [[ "$?" != 0 && -z "$RESULT" ]]; then
+ if [[ "$?" != 0 && -z "${RESULT}" ]]; then
echo "Cannot find '$1' and '$2' is not set in $ACCUMULO_CONF_DIR/accumulo-env.sh"
exit 1
fi
- while [ -h "$RESULT" ]; do # resolve $RESULT until the file is no longer a symlink
+ while [ -h "${RESULT}" ]; do # resolve $RESULT until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$RESULT" )" && pwd )"
- RESULT="$(readlink "$RESULT")"
- [[ $RESULT != /* ]] && RESULT="$DIR/$RESULT" # if $RESULT was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+ RESULT="$(readlink "${RESULT}")"
+ [[ "${RESULT}" != /* ]] && RESULT="${DIR}/${RESULT}" # if $RESULT was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
# find the relative home directory
- RESULT=$(dirname ${RESULT})
+ RESULT=$(dirname "${RESULT}")
echo "Auto-set ${2} to '${RESULT}'. To suppress this message, set ${2} in conf/accumulo-env.sh"
eval "${2}=${RESULT}"
}
-test -z "$JAVA_HOME" && locationByProgram java JAVA_HOME
-test -z "$HADOOP_PREFIX" && locationByProgram hadoop HADOOP_PREFIX
-test -z "$ZOOKEEPER_HOME" && locationByProgram zkCli.sh ZOOKEEPER_HOME
-
+test -z "${JAVA_HOME}" && locationByProgram java JAVA_HOME
+test -z "${HADOOP_PREFIX}" && locationByProgram hadoop HADOOP_PREFIX
+test -z "${ZOOKEEPER_HOME}" && locationByProgram zkCli.sh ZOOKEEPER_HOME
DEFAULT_GENERAL_JAVA_OPTS=""
@@ -62,7 +61,7 @@ DEFAULT_GENERAL_JAVA_OPTS=""
# ACCUMULO_XTRAJARS is where all of the commandline -add items go into for reading by accumulo.
#
if [ "$1" = "-add" ] ; then
- export ACCUMULO_XTRAJARS=$2
+ export ACCUMULO_XTRAJARS="$2"
shift 2
else
export ACCUMULO_XTRAJARS=""
@@ -80,28 +79,28 @@ logger) export ACCUMULO_OPTS="${ACCUMULO_GENERAL_OPTS} ${ACCUMULO_LOGGER_OPTS}"
*) export ACCUMULO_OPTS="${ACCUMULO_GENERAL_OPTS} ${ACCUMULO_OTHER_OPTS}" ;;
esac
-XML_FILES=${ACCUMULO_CONF_DIR}
-LOG4J_JAR=$(find $HADOOP_PREFIX/lib $HADOOP_PREFIX/share/hadoop/common/lib -name 'log4j*.jar' -print 2>/dev/null | head -1)
-CLASSPATH=${XML_FILES}:${START_JAR}:${LOG4J_JAR}
+XML_FILES="${ACCUMULO_CONF_DIR}"
+LOG4J_JAR=$(find "${HADOOP_PREFIX}/lib" "${HADOOP_PREFIX}"/share/hadoop/common/lib -name 'log4j*.jar' -print 2>/dev/null | head -1)
+CLASSPATH="${XML_FILES}:${START_JAR}:${LOG4J_JAR}"
-if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ]; then
+if [ -z "${JAVA_HOME}" -o ! -d "${JAVA_HOME}" ]; then
echo "JAVA_HOME is not set or is not a directory. Please make sure it's set globally or in conf/accumulo-env.sh"
exit 1
fi
-if [ -z "$HADOOP_PREFIX" -o ! -d "$HADOOP_PREFIX" ]; then
+if [ -z "${HADOOP_PREFIX}" -o ! -d "${HADOOP_PREFIX}" ]; then
echo "HADOOP_PREFIX is not set or is not a directory. Please make sure it's set globally or in conf/accumulo-env.sh"
exit 1
fi
-if [ -z "$ZOOKEEPER_HOME" -o ! -d "$ZOOKEEPER_HOME" ]; then
+if [ -z "${ZOOKEEPER_HOME}" -o ! -d "${ZOOKEEPER_HOME}" ]; then
echo "ZOOKEEPER_HOME is not set or is not a directory. Please make sure it's set globally or in conf/accumulo-env.sh"
exit 1
fi
-if [ -z "$ACCUMULO_LOG_DIR" ]; then
+if [ -z "${ACCUMULO_LOG_DIR}" ]; then
echo "ACCUMULO_LOG_DIR is not set. Please make sure it's set globally or in conf/accumulo-env.sh"
exit 1
fi
-if [ ! -d "$ACCUMULO_LOG_DIR" ]; then
+if [ ! -d "${ACCUMULO_LOG_DIR}" ]; then
mkdir -p "$ACCUMULO_LOG_DIR"
fi
@@ -109,21 +108,21 @@ fi
# This makes them available to java
export JAVA_HOME HADOOP_PREFIX ZOOKEEPER_HOME
-JAVA="$JAVA_HOME/bin/java"
-PLATFORM=$( $JAVA -cp $CLASSPATH org.apache.accumulo.start.Platform )
+JAVA="${JAVA_HOME}/bin/java"
+PLATFORM=$( "${JAVA}" -cp "${CLASSPATH}" org.apache.accumulo.start.Platform )
# hadoop 1.0, 1.1
-LIB_PATH="$HADOOP_PREFIX/lib/native/$PLATFORM"
-if [ ! -d "$LIB_PATH" ]; then
+LIB_PATH="${HADOOP_PREFIX}/lib/native/${PLATFORM}"
+if [ ! -d "${LIB_PATH}" ]; then
# hadoop-2.0
- LIB_PATH=$HADOOP_PREFIX/lib/native
+ LIB_PATH="${HADOOP_PREFIX}/lib/native"
fi
#
# app isn't used anywhere, but it makes the process easier to spot when ps/top/snmp truncate the command line
-exec $JAVA "-Dapp=$1" $ACCUMULO_OPTS -classpath $CLASSPATH -XX:OnOutOfMemoryError="kill -9 %p" \
+exec $JAVA "-Dapp=$1" $ACCUMULO_OPTS -classpath "${CLASSPATH}" -XX:OnOutOfMemoryError="kill -9 %p" \
-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl \
- -Djava.library.path="$LIB_PATH" \
- -Dorg.apache.accumulo.core.home.dir="$ACCUMULO_HOME" \
- -Dhadoop.home.dir="$HADOOP_PREFIX" \
- -Dzookeeper.home.dir="$ZOOKEEPER_HOME" \
+ -Djava.library.path="${LIB_PATH}" \
+ -Dorg.apache.accumulo.core.home.dir="${ACCUMULO_HOME}" \
+ -Dhadoop.home.dir="${HADOOP_PREFIX}" \
+ -Dzookeeper.home.dir="${ZOOKEEPER_HOME}" \
org.apache.accumulo.start.Main \
"$@"