You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by md...@apache.org on 2014/07/10 23:15:11 UTC
[1/2] ACCUMULO-2423 Clean up shell scripts
Repository: accumulo
Updated Branches:
refs/heads/master eb0cf2f4b -> d40c887b4
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/stop-scanners.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/stop-scanners.sh b/test/system/continuous/stop-scanners.sh
index 8b1852b..cf927b0 100755
--- a/test/system/continuous/stop-scanners.sh
+++ b/test/system/continuous/stop-scanners.sh
@@ -17,17 +17,17 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-pssh -h $CONTINUOUS_CONF_DIR/scanners.txt "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousScanner'" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/scanners.txt" "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousScanner'" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/stop-stats.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/stop-stats.sh b/test/system/continuous/stop-stats.sh
index a806f2d..9886eec 100755
--- a/test/system/continuous/stop-stats.sh
+++ b/test/system/continuous/stop-stats.sh
@@ -17,17 +17,17 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
pkill -f org.apache.accumulo.test.continuous.ContinuousStatsCollector
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/stop-walkers.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/stop-walkers.sh b/test/system/continuous/stop-walkers.sh
index 7e75969..2c22cfa 100755
--- a/test/system/continuous/stop-walkers.sh
+++ b/test/system/continuous/stop-walkers.sh
@@ -17,17 +17,17 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-pssh -h $CONTINUOUS_CONF_DIR/walkers.txt "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousWalk'" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/walkers.txt" "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousWalk'" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/randomwalk/bin/apocalypse.sh
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/bin/apocalypse.sh b/test/system/randomwalk/bin/apocalypse.sh
index 899256c..2855a7f 100755
--- a/test/system/randomwalk/bin/apocalypse.sh
+++ b/test/system/randomwalk/bin/apocalypse.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -17,33 +17,33 @@
#copied below from hadoop-config.sh
this="$0"
-while [ -h "$this" ]; do
- ls=`ls -ld "$this"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
+while [[ -h "$this" ]]; do
+ ls=$(ls -ld "$this")
+ link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' > /dev/null; then
this="$link"
else
- this=`dirname "$this"`/"$link"
+ this=$(dirname "$this")/"$link"
fi
done
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`cd "$bin"; pwd`
+bin=$(dirname "$this")
+script=$(basename "$this")
+bin=$(cd "$bin"; pwd)
this="$bin/$script"
-ACCUMULO_HOME=`dirname "$this"`/../../../..
-export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd`
+ACCUMULO_HOME=$(dirname "$this")/../../../..
+export ACCUMULO_HOME=$(cd "$ACCUMULO_HOME"; pwd)
-if [ -f $ACCUMULO_HOME/conf/accumulo-env.sh ] ; then
-. $ACCUMULO_HOME/conf/accumulo-env.sh
+if [[ -f $ACCUMULO_HOME/conf/accumulo-env.sh ]] ; then
+ . "$ACCUMULO_HOME/conf/accumulo-env.sh"
fi
-if [ -z $HADOOP_PREFIX ] ; then
+if [[ -z $HADOOP_PREFIX ]] ; then
echo "HADOOP_PREFIX is not set. Please make sure it's set globally."
exit 1
fi
echo 'killing all accumulo processes'
-pssh -h $ACCUMULO_HOME/conf/slaves "pkill -9 -f app=[tmg].*org.apache.accumulo.start " < /dev/null
-pssh -h $ACCUMULO_HOME/conf/masters "pkill -9 -f app=[tmg].*org.apache.accumulo.start " < /dev/null
+pssh -h "$ACCUMULO_HOME/conf/slaves" "pkill -9 -f app=[tmg].*org.apache.accumulo.start " < /dev/null
+pssh -h "$ACCUMULO_HOME/conf/masters" "pkill -9 -f app=[tmg].*org.apache.accumulo.start " < /dev/null
exit 0
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/randomwalk/bin/copy-config.sh
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/bin/copy-config.sh b/test/system/randomwalk/bin/copy-config.sh
index 01a90e0..48afc19 100755
--- a/test/system/randomwalk/bin/copy-config.sh
+++ b/test/system/randomwalk/bin/copy-config.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -16,23 +16,23 @@
# limitations under the License.
-if [ -z $HADOOP_PREFIX ] ; then
+if [[ -z $HADOOP_PREFIX ]] ; then
echo "HADOOP_PREFIX is not set. Please make sure it's set globally."
exit 1
fi
-if [ -z $ACCUMULO_HOME ] ; then
+if [[ -z $ACCUMULO_HOME ]] ; then
echo "ACCUMULO_HOME is not set. Please make sure it's set globally."
exit 1
fi
RW_HOME=$ACCUMULO_HOME/test/system/randomwalk
-cd $RW_HOME
+cd "$RW_HOME"
tar czf config.tgz conf
-$HADOOP_PREFIX/bin/hadoop fs -rmr /randomwalk 2>/dev/null
-$HADOOP_PREFIX/bin/hadoop fs -mkdir /randomwalk
-$HADOOP_PREFIX/bin/hadoop fs -put config.tgz /randomwalk
-$HADOOP_PREFIX/bin/hadoop fs -setrep 3 /randomwalk/config.tgz
+"$HADOOP_PREFIX/bin/hadoop" fs -rmr /randomwalk 2>/dev/null
+"$HADOOP_PREFIX/bin/hadoop" fs -mkdir /randomwalk
+"$HADOOP_PREFIX/bin/hadoop" fs -put config.tgz /randomwalk
+"$HADOOP_PREFIX/bin/hadoop" fs -setrep 3 /randomwalk/config.tgz
rm config.tgz
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/randomwalk/bin/kill-all.sh
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/bin/kill-all.sh b/test/system/randomwalk/bin/kill-all.sh
index 75e73af..e4bc0be 100755
--- a/test/system/randomwalk/bin/kill-all.sh
+++ b/test/system/randomwalk/bin/kill-all.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -17,24 +17,24 @@
#copied below from hadoop-config.sh
this="$0"
-while [ -h "$this" ]; do
- ls=`ls -ld "$this"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
+while [[ -h "$this" ]]; do
+ ls=$(ls -ld "$this")
+ link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' > /dev/null; then
this="$link"
else
- this=`dirname "$this"`/"$link"
+ this=$(dirname "$this")/"$link"
fi
done
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`cd "$bin"; pwd`
+bin=$(dirname "$this")
+script=$(basename "$this")
+bin=$(cd "$bin"; pwd)
this="$bin/$script"
-ACCUMULO_HOME=`dirname "$this"`/../../../..
-export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd`
+ACCUMULO_HOME=$(dirname "$this")/../../../..
+export ACCUMULO_HOME=$(cd "$ACCUMULO_HOME"; pwd)
RW_HOME=$ACCUMULO_HOME/test/system/randomwalk
echo 'killing random walkers'
-pssh -h $RW_HOME/conf/walkers "pkill -f [r]andomwalk.Framework" < /dev/null
+pssh -h "$RW_HOME/conf/walkers" "pkill -f [r]andomwalk.Framework" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/randomwalk/bin/kill-local.sh
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/bin/kill-local.sh b/test/system/randomwalk/bin/kill-local.sh
index 1d5af9b..2b35437 100755
--- a/test/system/randomwalk/bin/kill-local.sh
+++ b/test/system/randomwalk/bin/kill-local.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/randomwalk/bin/reset-cluster.sh
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/bin/reset-cluster.sh b/test/system/randomwalk/bin/reset-cluster.sh
index d394222..ab87eb2 100755
--- a/test/system/randomwalk/bin/reset-cluster.sh
+++ b/test/system/randomwalk/bin/reset-cluster.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -17,67 +17,67 @@
#copied below from hadoop-config.sh
this="$0"
-while [ -h "$this" ]; do
- ls=`ls -ld "$this"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
+while [[ -h "$this" ]]; do
+ ls=$(ls -ld "$this")
+ link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' > /dev/null; then
this="$link"
else
- this=`dirname "$this"`/"$link"
+ this=$(dirname "$this")/"$link"
fi
done
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`cd "$bin"; pwd`
+bin=$(dirname "$this")
+script=$(basename "$this")
+bin=$(cd "$bin"; pwd)
this="$bin/$script"
-ACCUMULO_HOME=`dirname "$this"`/../../../..
-export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd`
+ACCUMULO_HOME=$(dirname "$this")/../../../..
+export ACCUMULO_HOME=$(cd "$ACCUMULO_HOME"; pwd)
-if [ -z "$ACCUMULO_CONF_DIR" ] ; then
- $ACCUMULO_CONF_DIR=${ACCUMULO_HOME}/conf
+if [[ -z "$ACCUMULO_CONF_DIR" ]] ; then
+ ACCUMULO_CONF_DIR=${ACCUMULO_HOME}/conf
fi
-if [ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
-. $ACCUMULO_CONF_DIR/accumulo-env.sh
+if [[ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
+ . "$ACCUMULO_CONF_DIR/accumulo-env.sh"
fi
-if [ -z $HADOOP_PREFIX ] ; then
+if [[ -z $HADOOP_PREFIX ]] ; then
echo "HADOOP_PREFIX is not set. Please make sure it's set globally."
exit 1
fi
-if [ "$1" = "" ] ; then
+if [[ -z $1 ]] ; then
echo "Usage: update-cluster.sh <TARFILE>"
exit 1
fi
echo 'killing accumulo'
-pssh -h $ACCUMULO_CONF_DIR/slaves "pkill -f org.apache.accumulo.start" < /dev/null
+pssh -h "$ACCUMULO_CONF_DIR/slaves" "pkill -f org.apache.accumulo.start" < /dev/null
pkill -f org.apache.accumulo.start
pkill -f agitator.pl
echo 'updating accumulo'
-cd $ACCUMULO_HOME/..
-tar xzf $1
+cd "$ACCUMULO_HOME/.."
+tar xzf "$1"
echo 'cleaning logs directory'
-rm -f $ACCUMULO_HOME/logs/*
-rm -f $ACCUMULO_HOME/test/system/randomwalk/logs/*
-rm -f $ACCUMULO_HOME/test/system/continuous/logs/*
+rm -f "$ACCUMULO_HOME/logs/*"
+rm -f "$ACCUMULO_HOME/test/system/randomwalk/logs/*"
+rm -f "$ACCUMULO_HOME/test/system/continuous/logs/*"
rm -f ~/rwlogs/*
echo 'removing old code'
-pssh -h $ACCUMULO_CONF_DIR/slaves "rm -rf $ACCUMULO_HOME" < /dev/null
+pssh -h "$ACCUMULO_CONF_DIR/slaves" "rm -rf $ACCUMULO_HOME" < /dev/null
echo 'pushing new code'
-prsync -r -h $ACCUMULO_CONF_DIR/slaves $ACCUMULO_HOME /opt/dev
+prsync -r -h "$ACCUMULO_CONF_DIR/slaves" "$ACCUMULO_HOME" /opt/dev
echo 'removing /accumulo dir'
-$HADOOP_PREFIX/bin/hadoop fs -rmr /accumulo
+"$HADOOP_PREFIX/bin/hadoop" fs -rmr /accumulo
echo 'creating new instance'
-printf "test\nY\nsecret\nsecret\n" | $ACCUMULO_HOME/bin/accumulo init
+printf "test\nY\nsecret\nsecret\n" | "$ACCUMULO_HOME/bin/accumulo" init
echo 'starting accumulo'
-$ACCUMULO_HOME/bin/start-all.sh
+"$ACCUMULO_HOME/bin/start-all.sh"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/randomwalk/bin/start-all.sh
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/bin/start-all.sh b/test/system/randomwalk/bin/start-all.sh
index 48219c6..4734861 100755
--- a/test/system/randomwalk/bin/start-all.sh
+++ b/test/system/randomwalk/bin/start-all.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -17,38 +17,38 @@
#copied below from hadoop-config.sh
this="$0"
-while [ -h "$this" ]; do
- ls=`ls -ld "$this"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
+while [[ -h "$this" ]]; do
+ ls=$(ls -ld "$this")
+ link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' > /dev/null; then
this="$link"
else
- this=`dirname "$this"`/"$link"
+ this=$(dirname "$this")/"$link"
fi
done
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`cd "$bin"; pwd`
+bin=$(dirname "$this")
+script=$(basename "$this")
+bin=$(cd "$bin"; pwd)
this="$bin/$script"
-ACCUMULO_HOME=`dirname "$this"`/../../../..
-export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd`
+ACCUMULO_HOME=$(dirname "$this")/../../../..
+export ACCUMULO_HOME=$(cd "$ACCUMULO_HOME"; pwd)
-if [ -z "${ACCUMULO_CONF_DIR}" ]; then
+if [[ -z "${ACCUMULO_CONF_DIR}" ]]; then
export ACCUMULO_CONF_DIR=${ACCUMULO_HOME}/conf
fi
-if [ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
-. $ACCUMULO_CONF_DIR/accumulo-env.sh
+if [[ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
+ . "$ACCUMULO_CONF_DIR/accumulo-env.sh"
fi
-if [ -z "$HADOOP_PREFIX" ] ; then
+if [[ -z $HADOOP_PREFIX ]] ; then
echo "HADOOP_PREFIX is not set. Please make sure it's set globally."
exit 1
fi
-if [ "$1" = "" ] ; then
+if [[ -z $1 ]] ; then
echo "Usage: start-walkers.sh <startNode>"
exit 1
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/randomwalk/bin/start-local.sh
----------------------------------------------------------------------
diff --git a/test/system/randomwalk/bin/start-local.sh b/test/system/randomwalk/bin/start-local.sh
index 524a80b..0f8042c 100755
--- a/test/system/randomwalk/bin/start-local.sh
+++ b/test/system/randomwalk/bin/start-local.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -18,42 +18,42 @@
#copied below from hadoop-config.sh
this="$0"
-while [ -h "$this" ]; do
- ls=`ls -ld "$this"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
+while [[ -h "$this" ]]; do
+ ls=$(ls -ld "$this")
+ link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' > /dev/null; then
this="$link"
else
- this=`dirname "$this"`/"$link"
+ this=$(dirname "$this")/"$link"
fi
done
-bin=`dirname "$this"`
-script=`basename "$this"`
-bin=`cd "$bin"; pwd`
+bin=$(dirname "$this")
+script=$(basename "$this")
+bin=$(cd "$bin"; pwd)
this="$bin/$script"
-ACCUMULO_HOME=`dirname "$this"`/../../../..
-export ACCUMULO_HOME=`cd $ACCUMULO_HOME; pwd`
+ACCUMULO_HOME=$(dirname "$this")/../../../..
+export ACCUMULO_HOME=$(cd "$ACCUMULO_HOME"; pwd)
-if [ -z "$ACCUMULO_CONF_DIR" ] ; then
+if [[ -z "$ACCUMULO_CONF_DIR" ]] ; then
export ACCUMULO_CONF_DIR=${ACCUMULO_HOME}/conf
fi
-if [ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
-. $ACCUMULO_CONF_DIR/accumulo-env.sh
+if [[ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
+ . "$ACCUMULO_CONF_DIR/accumulo-env.sh"
fi
-if [ -z "$HADOOP_PREFIX" ] ; then
+if [[ -z $HADOOP_PREFIX ]] ; then
echo "HADOOP_PREFIX is not set. Please make sure it's set globally."
exit 1
fi
-if [ "$1" = "" ] ; then
+if [[ -z $1 ]] ; then
echo "Usage: start-local.sh <startNode>"
exit 1
fi
-RW_HOME="$ACCUMULO_HOME/test/system/randomwalk"
+RW_HOME=$ACCUMULO_HOME/test/system/randomwalk
cd "$RW_HOME"
@@ -61,7 +61,7 @@ cd "$RW_HOME"
"$HADOOP_PREFIX/bin/hadoop" fs -get /randomwalk/config.tgz config.tgz
# extract config to a tmp directory
-TEMP="`hostname`-tmp"
+TEMP="$(hostname)-tmp"
rm -rf "$TEMP"
mkdir "$TEMP"
tar xzf config.tgz -C "$TEMP"
@@ -69,11 +69,11 @@ rm config.tgz
# config the logging
RW_LOGS="$RW_HOME/logs"
-if [ ! -d "$RW_LOGS" ]
+if [[ ! -d "$RW_LOGS" ]]
then
mkdir -p "$RW_LOGS" || ( echo "cannot create $RW_LOGS" ; exit 1 )
fi
-LOG_ID=`hostname -s`_`date +%Y%m%d_%H%M%S`
+LOG_ID=$(hostname -s)_$(date +%Y%m%d_%H%M%S)
# run the local walker
"$ACCUMULO_HOME/bin/accumulo" org.apache.accumulo.test.randomwalk.Framework --configDir "$RW_HOME/$TEMP/conf/" --logDir "$RW_LOGS" --logId "$LOG_ID" --module "$1" >"$RW_LOGS/$LOG_ID.out" 2>"$RW_LOGS/$LOG_ID.err" &
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/stress/reader.sh
----------------------------------------------------------------------
diff --git a/test/system/stress/reader.sh b/test/system/stress/reader.sh
index 1138685..e282632 100755
--- a/test/system/stress/reader.sh
+++ b/test/system/stress/reader.sh
@@ -19,20 +19,21 @@
# Ref: http://stackoverflow.com/questions/59895/
SOURCE="${BASH_SOURCE[0]}"
while [ -h "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
- SOURCE="$(readlink "${SOURCE}")"
+ DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
+ SOURCE=$(readlink "${SOURCE}")
[[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
-DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
# Stop: Resolve Script Directory
LOG_DIR=${DIR}/logs
-mkdir -p $LOG_DIR
+mkdir -p "$LOG_DIR"
# Source environment
-. ${DIR}/stress-env.sh
+. "${DIR}/stress-env.sh"
ts=$(date +%Y%m%d%H%M%S)
host=$(hostname)
-${ACCUMULO_HOME}/bin/accumulo org.apache.accumulo.test.stress.random.Scan $INSTANCE $USERPASS $SCAN_SEED $CONTINUOUS_SCAN $SCAN_BATCH_SIZE \
- > $LOG_DIR/${ts}_${host}_reader.out \
- 2> $LOG_DIR/${ts}_${host}_reader.err
+# We want USERPASS to word split
+"${ACCUMULO_HOME}/bin/accumulo org.apache.accumulo.test.stress.random.Scan" "$INSTANCE" $USERPASS "$SCAN_SEED" "$CONTINUOUS_SCAN" "$SCAN_BATCH_SIZE" \
+ > "$LOG_DIR/${ts}_${host}_reader.out" \
+ 2> "$LOG_DIR/${ts}_${host}_reader.err"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/stress/start-readers.sh
----------------------------------------------------------------------
diff --git a/test/system/stress/start-readers.sh b/test/system/stress/start-readers.sh
index 709c46e..6f651f4 100755
--- a/test/system/stress/start-readers.sh
+++ b/test/system/stress/start-readers.sh
@@ -27,7 +27,7 @@ DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
# Stop: Resolve Script Directory
# Source environment
-. ${DIR}/stress-env.sh
+. "${DIR}/stress-env.sh"
if [[ ! -f ${DIR}/readers ]]; then
echo readers file is missing
@@ -35,6 +35,6 @@ if [[ ! -f ${DIR}/readers ]]; then
fi
# Copy environment out
-pscp -h ${DIR}/readers ${DIR}/stress-env.sh ${DIR}
+pscp -h "${DIR}/readers" "${DIR}/stress-env.sh" "${DIR}"
-pssh -h ${DIR}/readers "nohup ${DIR}/reader.sh >${DIR}/reader.out 2>${DIR}/reader.err < /dev/null &"
+pssh -h "${DIR}/readers" "nohup ${DIR}/reader.sh >${DIR}/reader.out 2>${DIR}/reader.err < /dev/null &"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/stress/start-writers.sh
----------------------------------------------------------------------
diff --git a/test/system/stress/start-writers.sh b/test/system/stress/start-writers.sh
index b9464cc..474117c 100755
--- a/test/system/stress/start-writers.sh
+++ b/test/system/stress/start-writers.sh
@@ -19,15 +19,15 @@
# Ref: http://stackoverflow.com/questions/59895/
SOURCE="${BASH_SOURCE[0]}"
while [ -h "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
- SOURCE="$(readlink "${SOURCE}")"
+ DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
+ SOURCE=$(readlink "${SOURCE}")
[[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
-DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
# Stop: Resolve Script Directory
# Source environment
-. ${DIR}/stress-env.sh
+. "${DIR}/stress-env.sh"
if [[ ! -f ${DIR}/writers ]]; then
echo writers file is missing
@@ -35,6 +35,6 @@ if [[ ! -f ${DIR}/writers ]]; then
fi
# Copy environment out
-pscp -h ${DIR}/writers ${DIR}/stress-env.sh ${DIR}
+pscp -h "${DIR}/writers" "${DIR}/stress-env.sh" "${DIR}"
-pssh -h ${DIR}/writers "nohup ${DIR}/writer.sh >${DIR}/writer.out 2>${DIR}/writer.err < /dev/null &"
+pssh -h "${DIR}/writers" "nohup ${DIR}/writer.sh >${DIR}/writer.out 2>${DIR}/writer.err < /dev/null &"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/stress/stop-readers.sh
----------------------------------------------------------------------
diff --git a/test/system/stress/stop-readers.sh b/test/system/stress/stop-readers.sh
index 1c59971..8bd4a6f 100755
--- a/test/system/stress/stop-readers.sh
+++ b/test/system/stress/stop-readers.sh
@@ -19,18 +19,18 @@
# Ref: http://stackoverflow.com/questions/59895/
SOURCE="${BASH_SOURCE[0]}"
while [ -h "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
- SOURCE="$(readlink "${SOURCE}")"
+ DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
+ SOURCE=$(readlink "${SOURCE}")
[[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
-DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
# Stop: Resolve Script Directory
# Source environment
-. ${DIR}/stress-env.sh
+. "${DIR}/stress-env.sh"
-if [[ ! -f ${DIR}/readers ]]; then
+if [[ ! -f "${DIR}/readers" ]]; then
echo readers file is missing
exit 1
fi
-pssh -h ${DIR}/readers "pkill -f '[o]rg.apache.accumulo.test.stress.random.Scan'" < /dev/null
+pssh -h "${DIR}/readers" "pkill -f '[o]rg.apache.accumulo.test.stress.random.Scan'" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/stress/stop-writers.sh
----------------------------------------------------------------------
diff --git a/test/system/stress/stop-writers.sh b/test/system/stress/stop-writers.sh
index d925cb3..5c9e8d7 100755
--- a/test/system/stress/stop-writers.sh
+++ b/test/system/stress/stop-writers.sh
@@ -19,18 +19,18 @@
# Ref: http://stackoverflow.com/questions/59895/
SOURCE="${BASH_SOURCE[0]}"
while [ -h "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
- SOURCE="$(readlink "${SOURCE}")"
+ DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
+ SOURCE=$(readlink "${SOURCE}")
[[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
-DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
# Stop: Resolve Script Directory
# Source environment
-. ${DIR}/stress-env.sh
+. "${DIR}/stress-env.sh"
-if [[ ! -f ${DIR}/writers ]]; then
+if [[ ! -f "${DIR}/writers" ]]; then
echo writers file is missing
exit 1
fi
-pssh -h ${DIR}/writers "pkill -f '[o]rg.apache.accumulo.test.stress.random.Write'" < /dev/null
+pssh -h "${DIR}/writers" "pkill -f '[o]rg.apache.accumulo.test.stress.random.Write'" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/stress/writer.sh
----------------------------------------------------------------------
diff --git a/test/system/stress/writer.sh b/test/system/stress/writer.sh
index ef26fed..7107242 100755
--- a/test/system/stress/writer.sh
+++ b/test/system/stress/writer.sh
@@ -19,24 +19,26 @@
# Ref: http://stackoverflow.com/questions/59895/
SOURCE="${BASH_SOURCE[0]}"
while [ -h "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink
- DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
- SOURCE="$(readlink "${SOURCE}")"
+ DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
+ SOURCE=$(readlink "${SOURCE}")
[[ "${SOURCE}" != /* ]] && SOURCE="${DIR}/${SOURCE}" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
-DIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
+DIR=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
# Stop: Resolve Script Directory
LOG_DIR=${DIR}/logs
-mkdir -p $LOG_DIR
+mkdir -p "$LOG_DIR"
# Source environment
-. ${DIR}/stress-env.sh
+. "${DIR}/stress-env.sh"
ts=$(date +%Y%m%d%H%M%S)
host=$(hostname)
# TBD - --clear-table option
-${ACCUMULO_HOME}/bin/accumulo org.apache.accumulo.test.stress.random.Write $INSTANCE $USERPASS $ROW_RANGE $CF_RANGE $CQ_RANGE $VALUE_RANGE \
- $ROW_SEED $CF_SEED $CQ_SEED $VALUE_SEED $ROW_WIDTH $ROW_WIDTH_SEED $MAX_CELLS_PER_MUTATION $WRITE_DELAY \
- > $LOG_DIR/${ts}_${host}_writer.out \
- 2> $LOG_DIR/${ts}_${host}_writer.err
+# We want $USERPASS to word split
+"${ACCUMULO_HOME}/bin/accumulo org.apache.accumulo.test.stress.random.Write" "$INSTANCE" $USERPASS "$ROW_RANGE" "$CF_RANGE" "$CQ_RANGE" "$VALUE_RANGE" \
+ "$ROW_SEED" "$CF_SEED" "$CQ_SEED" "$VALUE_SEED" \
+ "$ROW_WIDTH" "$ROW_WIDTH_SEED" "$MAX_CELLS_PER_MUTATION" "$WRITE_DELAY" \
+ > "$LOG_DIR/${ts}_${host}_writer.out" \
+ 2> "$LOG_DIR/${ts}_${host}_writer.err"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/upgrade_test.sh
----------------------------------------------------------------------
diff --git a/test/system/upgrade_test.sh b/test/system/upgrade_test.sh
index 6259e1c..590c07c 100755
--- a/test/system/upgrade_test.sh
+++ b/test/system/upgrade_test.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -16,9 +16,9 @@
# limitations under the License.
-if [ $# -ne 1 ]
-then
- echo "Usage: `basename $0` clean|dirty"
+if [[ $# != 1 ]] ; then
+ BASENAME=$(basename "$0")
+ echo "Usage: $BASENAME clean|dirty"
exit -1
fi
@@ -34,43 +34,43 @@ DIR=/accumulo
BULK=/tmp/upt
pkill -f accumulo.start
-hadoop fs -rmr $DIR
-hadoop fs -rmr $BULK
-hadoop fs -mkdir $BULK/fail
+hadoop fs -rmr "$DIR"
+hadoop fs -rmr "$BULK"
+hadoop fs -mkdir "$BULK/fail"
-$PREV/bin/accumulo init --clear-instance-name --instance-name testUp --password secret
-$PREV/bin/start-all.sh
+"$PREV/bin/accumulo" init --clear-instance-name --instance-name testUp --password secret
+"$PREV/bin/start-all.sh"
-$PREV/bin/accumulo org.apache.accumulo.test.TestIngest -u root -p secret --timestamp 1 --size 50 --random 56 --rows 200000 --start 0 --cols 1 --createTable --splits 10
-$PREV/bin/accumulo org.apache.accumulo.test.TestIngest --rfile $BULK/bulk/test --timestamp 1 --size 50 --random 56 --rows 200000 --start 200000 --cols 1
+"$PREV/bin/accumulo" org.apache.accumulo.test.TestIngest -u root -p secret --timestamp 1 --size 50 --random 56 --rows 200000 --start 0 --cols 1 --createTable --splits 10
+"$PREV/bin/accumulo" org.apache.accumulo.test.TestIngest --rfile $BULK/bulk/test --timestamp 1 --size 50 --random 56 --rows 200000 --start 200000 --cols 1
echo -e "table test_ingest\nimportdirectory $BULK/bulk $BULK/fail false" | $PREV/bin/accumulo shell -u root -p secret
-if [ $1 == "dirty" ]; then
+if [[ $1 == dirty ]]; then
pkill -9 -f accumulo.start
else
- $PREV/bin/stop-all.sh
+ "$PREV/bin/stop-all.sh"
fi
echo "==== Starting Current ==="
-$CURR/bin/start-all.sh
-$CURR/bin/accumulo org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 1 --random 56 --rows 400000 --start 0 --cols 1 -u root -p secret
+"$CURR/bin/start-all.sh"
+"$CURR/bin/accumulo" org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 1 --random 56 --rows 400000 --start 0 --cols 1 -u root -p secret
echo "compact -t test_ingest -w" | $CURR/bin/accumulo shell -u root -p secret
-$CURR/bin/accumulo org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 1 --random 56 --rows 400000 --start 0 --cols 1 -u root -p secret
+"$CURR/bin/accumulo" org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 1 --random 56 --rows 400000 --start 0 --cols 1 -u root -p secret
-$CURR/bin/accumulo org.apache.accumulo.test.TestIngest --timestamp 2 --size 50 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
-$CURR/bin/accumulo org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
+"$CURR/bin/accumulo" org.apache.accumulo.test.TestIngest --timestamp 2 --size 50 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
+"$CURR/bin/accumulo" org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
echo "compact -t test_ingest -w" | $CURR/bin/accumulo shell -u root -p secret
-$CURR/bin/accumulo org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
+"$CURR/bin/accumulo" org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
-$CURR/bin/stop-all.sh
-$CURR/bin/start-all.sh
+"$CURR/bin/stop-all.sh"
+"$CURR/bin/start-all.sh"
-$CURR/bin/accumulo org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
+"$CURR/bin/accumulo" org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
pkill -9 -f accumulo.start
-$CURR/bin/start-all.sh
+"$CURR/bin/start-all.sh"
-$CURR/bin/accumulo org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
+"$CURR/bin/accumulo" org.apache.accumulo.test.VerifyIngest --size 50 --timestamp 2 --random 57 --rows 500000 --start 0 --cols 1 -u root -p secret
[2/2] git commit: ACCUMULO-2423 Clean up shell scripts
Posted by md...@apache.org.
ACCUMULO-2423 Clean up shell scripts
Standardize interpreter line on '#! /usr/bin/env foo'
Replace `..` with $(..)
Replace [..] with [[..]]
Replace = with == in [[..]]
Replace arithmetic [[..]] with ((..))
Remove useless invocations of echo
Add double quotes to prevent word splitting
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/d40c887b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/d40c887b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/d40c887b
Branch: refs/heads/master
Commit: d40c887b418b36f578755a5a083dc750a24a936a
Parents: eb0cf2f
Author: Mike Drob <md...@cloudera.com>
Authored: Tue Mar 4 10:08:08 2014 -0500
Committer: Mike Drob <md...@cloudera.com>
Committed: Thu Jul 10 15:05:26 2014 -0500
----------------------------------------------------------------------
assemble/bin/LogForwarder.sh | 8 +-
assemble/bin/accumulo | 17 ++---
assemble/bin/bootstrap_config.sh | 14 ++--
assemble/bin/bootstrap_hdfs.sh | 15 ++--
assemble/bin/build_native_library.sh | 22 +++---
assemble/bin/config.sh | 78 +++++++++-----------
assemble/bin/generate_monitor_certificate.sh | 30 ++++----
assemble/bin/start-all.sh | 6 +-
assemble/bin/start-here.sh | 35 +++++----
assemble/bin/start-server.sh | 46 ++++++------
assemble/bin/stop-all.sh | 28 +++----
assemble/bin/stop-here.sh | 16 ++--
assemble/bin/stop-server.sh | 30 ++++----
assemble/bin/tool.sh | 10 +--
assemble/bin/tup.sh | 5 +-
assemble/build.sh | 19 +++--
assemble/conf/templates/accumulo-env.sh | 7 +-
core/src/main/scripts/generate-protobuf.sh | 26 +++----
core/src/main/scripts/generate-thrift.sh | 38 +++++-----
proxy/examples/python/TestClient.py | 3 +-
start/src/test/shell/makeTestJars.sh | 4 +-
test/src/test/scripts/run-test.sh | 22 +++---
test/system/continuous/analyze-missing.sh | 4 +-
.../system/continuous/continuous-env.sh.example | 6 +-
test/system/continuous/mapred-setup.sh | 4 +-
test/system/continuous/run-moru.sh | 10 +--
test/system/continuous/run-verify.sh | 20 ++---
test/system/continuous/start-agitator.sh | 43 +++++------
test/system/continuous/start-batchwalkers.sh | 24 +++---
test/system/continuous/start-ingest.sh | 30 ++++----
test/system/continuous/start-scanners.sh | 22 +++---
test/system/continuous/start-stats.sh | 37 +++++-----
test/system/continuous/start-walkers.sh | 26 +++----
test/system/continuous/stop-agitator.sh | 27 +++----
test/system/continuous/stop-batchwalkers.sh | 12 +--
test/system/continuous/stop-ingest.sh | 12 +--
test/system/continuous/stop-scanners.sh | 12 +--
test/system/continuous/stop-stats.sh | 10 +--
test/system/continuous/stop-walkers.sh | 12 +--
test/system/randomwalk/bin/apocalypse.sh | 30 ++++----
test/system/randomwalk/bin/copy-config.sh | 16 ++--
test/system/randomwalk/bin/kill-all.sh | 22 +++---
test/system/randomwalk/bin/kill-local.sh | 2 +-
test/system/randomwalk/bin/reset-cluster.sh | 54 +++++++-------
test/system/randomwalk/bin/start-all.sh | 30 ++++----
test/system/randomwalk/bin/start-local.sh | 38 +++++-----
test/system/stress/reader.sh | 17 +++--
test/system/stress/start-readers.sh | 6 +-
test/system/stress/start-writers.sh | 12 +--
test/system/stress/stop-readers.sh | 12 +--
test/system/stress/stop-writers.sh | 12 +--
test/system/stress/writer.sh | 20 ++---
test/system/upgrade_test.sh | 48 ++++++------
53 files changed, 534 insertions(+), 575 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/LogForwarder.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/LogForwarder.sh b/assemble/bin/LogForwarder.sh
index 5fe7871..d625580 100755
--- a/assemble/bin/LogForwarder.sh
+++ b/assemble/bin/LogForwarder.sh
@@ -37,14 +37,14 @@
# 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")"
+ 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 )"
+bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
script=$( basename "$SOURCE" )
# Stop: Resolve Script Directory
. "$bin"/config.sh
-${JAVA_HOME}/bin/java -cp $ACCUMULO_HOME/lib org.apache.accumulo.server.util.SendLogToChainsaw -d $ACCUMULO_LOG_DIR "$@"
+"${JAVA_HOME}/bin/java" -cp "$ACCUMULO_HOME/lib" org.apache.accumulo.server.util.SendLogToChainsaw -d "$ACCUMULO_LOG_DIR" "$@"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/accumulo
----------------------------------------------------------------------
diff --git a/assemble/bin/accumulo b/assemble/bin/accumulo
index bdd742d..727a4c8 100755
--- a/assemble/bin/accumulo
+++ b/assemble/bin/accumulo
@@ -29,11 +29,6 @@ script=$( basename "${SOURCE}" )
. "${bin}"/config.sh
START_JAR="${ACCUMULO_HOME}/lib/accumulo-start.jar"
-if [ ! -f "$START_JAR" ]; then
- if [ -x /bin/rpm ]; then
- START_JAR=$(echo $(/bin/rpm -E "%{_javadir}/accumulo/"accumulo-start-*.jar))
- fi
-fi
#
# Resolve a program to its installation directory
@@ -51,7 +46,7 @@ locationByProgram()
[[ "${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, accounting for an extra bin directory
- RESULT=$(dirname $(dirname "${RESULT}") )
+ RESULT=$(dirname "$(dirname "${RESULT}")")
echo "Auto-set ${2} to '${RESULT}'. To suppress this message, set ${2} in conf/accumulo-env.sh"
eval "${2}=${RESULT}"
}
@@ -82,9 +77,9 @@ if [ "$1" = "jar" -a -f "$2" ] ; then
fi
if jar tf "$jarfile" | grep -q META-INF/MANIFEST.MF ; then
cp="$(unzip -p "$jarfile" META-INF/MANIFEST.MF | grep ^Class-Path: | sed 's/^Class-Path: *//')"
- if [ -n "$cp" ] ; then
+ if [[ -n "$cp" ]] ; then
for j in $cp; do
- if [ "$j" != "Class-Path:" ]; then
+ if [[ "$j" != "Class-Path:" ]] ; then
ACCUMULO_XTRAJARS="${jardir}/${j},$ACCUMULO_XTRAJARS"
fi
done
@@ -96,11 +91,11 @@ fi
#
# Set up -D switches for JAAS and Kerberos if env variables set
#
-if [ ! -z ${ACCUMULO_JAAS_CONF} ]; then
+if [[ ! -z ${ACCUMULO_JAAS_CONF} ]]; then
ACCUMULO_GENERAL_OPTS="${ACCUMULO_GENERAL_OPTS} -Djava.security.auth.login.config=${ACCUMULO_JAAS_CONF}"
fi
-if [ ! -z ${ACCUMULO_KRB5_CONF} ]; then
+if [[ ! -z ${ACCUMULO_KRB5_CONF} ]]; then
ACCUMULO_GENERAL_OPTS="${ACCUMULO_GENERAL_OPTS} -Djava.security.krb5.conf=${ACCUMULO_KRB5_CONF}"
fi
@@ -158,7 +153,7 @@ export JAVA_HOME HADOOP_PREFIX ZOOKEEPER_HOME LD_LIBRARY_PATH DYLD_LIBRARY_PATH
#
# app isn't used anywhere, but it makes the process easier to spot when ps/top/snmp truncate the command line
JAVA="${JAVA_HOME}/bin/java"
-exec $JAVA "-Dapp=$1" \
+exec "$JAVA" "-Dapp=$1" \
$ACCUMULO_OPTS \
-classpath "${CLASSPATH}" \
-XX:OnOutOfMemoryError="${ACCUMULO_KILL_CMD:-kill -9 %p}" \
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/bootstrap_config.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/bootstrap_config.sh b/assemble/bin/bootstrap_config.sh
index fb643da..7640418 100755
--- a/assemble/bin/bootstrap_config.sh
+++ b/assemble/bin/bootstrap_config.sh
@@ -294,17 +294,17 @@ sed -e "s/\${memMapMax}/${!MEMORY_MAP_MAX}/" \
#Configure for hadoop 1
if [[ "$HADOOP_VERSION" = "1" ]]; then
- sed -e 's/^test -z \"$HADOOP_CONF_DIR\"/#test -z \"$HADOOP_CONF_DIR\"/' -e 's/^# test -z "$HADOOP_CONF_DIR"/test -z \"$HADOOP_CONF_DIR\"/' ${CONF_DIR}/$ACCUMULO_ENV > temp
- mv temp ${CONF_DIR}/$ACCUMULO_ENV
+ sed -e 's/^test -z \"$HADOOP_CONF_DIR\"/#test -z \"$HADOOP_CONF_DIR\"/' -e 's/^# test -z "$HADOOP_CONF_DIR"/test -z \"$HADOOP_CONF_DIR\"/' "${CONF_DIR}/$ACCUMULO_ENV" > temp
+ mv temp "${CONF_DIR}/$ACCUMULO_ENV"
sed -e 's/<!-- Hadoop 2 requirements -->/<!-- Hadoop 2 requirements -->\n <!--/' \
-e 's/<!-- End Hadoop 2 requirements -->/-->\n <!-- End Hadoop 2 requirements -->/' \
- ${CONF_DIR}/$ACCUMULO_SITE > temp
- mv temp ${CONF_DIR}/$ACCUMULO_SITE
+ "${CONF_DIR}/$ACCUMULO_SITE" > temp
+ mv temp "${CONF_DIR}/$ACCUMULO_SITE"
fi
#Additional setup steps for native configuration.
-if [[ "${TYPE}" = "native" ]]; then
- if [[ "$(uname)" = 'Linux' ]]; then
+if [[ ${TYPE} == native ]]; then
+ if [[ $(uname) == Linux ]]; then
if [[ -z $HADOOP_PREFIX ]]; then
echo "HADOOP_PREFIX not set cannot automatically configure LD_LIBRARY_PATH"
else
@@ -313,7 +313,7 @@ if [[ "${TYPE}" = "native" ]]; then
echo -e "Native libraries could not be found for your sytem in: $HADOOP_PREFIX"
else
sed "/# Should the monitor/ i export LD_LIBRARY_PATH=${NATIVE_LIB}:\${LD_LIBRARY_PATH}" ${CONF_DIR}/$ACCUMULO_ENV > temp
- mv temp ${CONF_DIR}/$ACCUMULO_ENV
+ mv temp "${CONF_DIR}/$ACCUMULO_ENV"
echo -e "Added ${NATIVE_LIB} to the LD_LIBRARY_PATH"
fi
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/bootstrap_hdfs.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/bootstrap_hdfs.sh b/assemble/bin/bootstrap_hdfs.sh
index 6f38f63..881b875 100755
--- a/assemble/bin/bootstrap_hdfs.sh
+++ b/assemble/bin/bootstrap_hdfs.sh
@@ -48,22 +48,19 @@ fi
# Create the system context directy in HDFS if it does not exist
#
"$HADOOP_PREFIX/bin/hadoop" fs -ls "$SYSTEM_CONTEXT_HDFS_DIR" > /dev/null
-if [ $? -ne 0 ]; then
+if [[ $? != 0 ]]; then
"$HADOOP_PREFIX/bin/hadoop" fs -mkdir "$SYSTEM_CONTEXT_HDFS_DIR" > /dev/null
fi
#
# Replicate to all slaves to avoid network contention on startup
#
-SLAVES="$ACCUMULO_CONF_DIR/slaves"
+SLAVES=$ACCUMULO_CONF_DIR/slaves
NUM_SLAVES=$(egrep -v '(^#|^\s*$)' "$SLAVES" | wc -l)
#let each datanode service around 50 clients
-let "REP=$NUM_SLAVES/50"
-
-if [ $REP -lt 3 ]; then
- REP=3
-fi
+REP=$(( NUM_SLAVES / 50 ))
+(( REP < 3 )) && REP=3
#
# Copy all jars in lib to the system context directory
@@ -78,7 +75,7 @@ fi
"$HADOOP_PREFIX/bin/hadoop" fs -rmr "$SYSTEM_CONTEXT_HDFS_DIR/commons-vfs2.jar" > /dev/null
"$HADOOP_PREFIX/bin/hadoop" fs -copyToLocal "$SYSTEM_CONTEXT_HDFS_DIR/accumulo-start.jar" "$ACCUMULO_HOME/lib/." > /dev/null
"$HADOOP_PREFIX/bin/hadoop" fs -rmr "$SYSTEM_CONTEXT_HDFS_DIR/accumulo-start.jar" > /dev/null
-for f in `cat $ACCUMULO_CONF_DIR/slaves`
+for f in $(grep -v '^#' "$ACCUMULO_CONF_DIR/slaves")
do
- rsync -ra --delete $ACCUMULO_HOME `dirname $ACCUMULO_HOME`
+ rsync -ra --delete "$ACCUMULO_HOME" $(dirname "$ACCUMULO_HOME")
done
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/build_native_library.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/build_native_library.sh b/assemble/bin/build_native_library.sh
index 907ce2c..d04edf3 100755
--- a/assemble/bin/build_native_library.sh
+++ b/assemble/bin/build_native_library.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -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 )"
+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 )"
+bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
script=$( basename "$SOURCE" )
# Stop: Resolve Script Directory
-lib="${bin}/../lib"
-native_tarball="${lib}/accumulo-native.tar.gz"
+lib=${bin}/../lib
+native_tarball=${lib}/accumulo-native.tar.gz
final_native_target="${lib}/native"
if [[ ! -f $native_tarball ]]; then
@@ -40,27 +40,27 @@ fi
mkdir -p "${final_native_target}"
# Make a directory for us to unpack the native source into
-TMP_DIR=`mktemp -d /tmp/accumulo-native.XXXX` || exit 1
+TMP_DIR=$(mktemp -d /tmp/accumulo-native.XXXX) || exit 1
# Unpack the tarball to our temp directory
tar xf "${native_tarball}" -C "${TMP_DIR}"
-if [[ $? -ne 0 ]]; then
+if [[ $? != 0 ]]; then
echo "Failed to unpack native tarball to ${TMP_DIR}"
exit 1
fi
# Move to the first (only) directory in our unpacked tarball
-native_dir=`find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -type d`
+native_dir=$(find "${TMP_DIR}" -maxdepth 1 -mindepth 1 -type d)
cd "${native_dir}"
# Make the native library
-export USERFLAGS=$@
+export USERFLAGS="$@"
make
# Make sure it didn't fail
-if [[ $? -ne 0 ]]; then
+if [[ $? != 0 ]]; then
echo "Make failed!"
exit 1
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/config.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/config.sh b/assemble/bin/config.sh
index 7663473..36cebb0 100755
--- a/assemble/bin/config.sh
+++ b/assemble/bin/config.sh
@@ -46,69 +46,63 @@
if [ -z "${ACCUMULO_HOME}" ] ; then
# 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")"
+ 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 )"
+ bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
script=$( basename "$SOURCE" )
# Stop: Resolve Script Directory
- ACCUMULO_HOME=$( cd -P ${bin}/.. && pwd )
+ ACCUMULO_HOME=$( cd -P "${bin}"/.. && pwd )
export ACCUMULO_HOME
fi
-if [ ! -d "${ACCUMULO_HOME}" ]; then
+if [[ ! -d ${ACCUMULO_HOME} ]]; then
echo "ACCUMULO_HOME=${ACCUMULO_HOME} is not a valid directory. Please make sure it exists"
exit 1
fi
-ACCUMULO_CONF_DIR="${ACCUMULO_CONF_DIR:-$ACCUMULO_HOME/conf}"
-export ACCUMULO_CONF_DIR
-if [ -z "$ACCUMULO_CONF_DIR" -o ! -d "$ACCUMULO_CONF_DIR" ]
+export ACCUMULO_CONF_DIR="${ACCUMULO_CONF_DIR:-$ACCUMULO_HOME/conf}"
+if [[ -z $ACCUMULO_CONF_DIR || ! -d $ACCUMULO_CONF_DIR ]]
then
echo "ACCUMULO_CONF_DIR=$ACCUMULO_CONF_DIR is not a valid directory. Please make sure it exists"
exit 1
fi
-if [ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ] ; then
- . $ACCUMULO_CONF_DIR/accumulo-env.sh
-elif [ -z "$ACCUMULO_TEST" ] ; then
+if [[ -f $ACCUMULO_CONF_DIR/accumulo-env.sh ]] ; then
+ . "$ACCUMULO_CONF_DIR/accumulo-env.sh"
+elif [[ -z $ACCUMULO_TEST ]] ; then
#
# Attempt to bootstrap configuration and continue
#
- echo ""
- echo "Accumulo is not properly configured."
- echo ""
- echo "Try running \$ACCUMULO_HOME/bin/bootstrap_config.sh and then editing"
- echo "\$ACCUMULO_HOME/conf/accumulo-env.sh"
- echo ""
+ echo
+ echo 'Accumulo is not properly configured.'
+ echo
+ echo 'Try running $ACCUMULO_HOME/bin/bootstrap_config.sh and then editing'
+ echo '$ACCUMULO_HOME/conf/accumulo-env.sh'
+ echo
exit 1
fi
-if [ -z ${ACCUMULO_LOG_DIR} ]; then
- ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs
-fi
-
-if [ -z "${ACCUMULO_VERIFY_ONLY}" ] ; then
- mkdir -p $ACCUMULO_LOG_DIR 2>/dev/null
-fi
+[[ -z $ACCUMULO_LOG_DIR ]] && ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs
+[[ -z $ACCUMULO_VERIFY_ONLY ]] && mkdir -p $ACCUMULO_LOG_DIR 2>/dev/null
export ACCUMULO_LOG_DIR
-if [ -z "$HADOOP_PREFIX" ]
+if [[ -z "$HADOOP_PREFIX" ]]
then
- HADOOP_PREFIX="`which hadoop`"
- if [ -z "$HADOOP_PREFIX" ]
+ HADOOP_PREFIX="$(which hadoop)"
+ if [[ -z "$HADOOP_PREFIX" ]]
then
echo "You must set HADOOP_PREFIX"
exit 1
fi
- HADOOP_PREFIX=`dirname $HADOOP_PREFIX`
- HADOOP_PREFIX=`dirname $HADOOP_PREFIX`
+ HADOOP_PREFIX=$(dirname "$HADOOP_PREFIX")
+ HADOOP_PREFIX=$(dirname "$HADOOP_PREFIX")
fi
-if [ ! -d "$HADOOP_PREFIX" ]
+if [[ ! -d "$HADOOP_PREFIX" ]]
then
echo "HADOOP_PREFIX, which has a value of $HADOOP_PREFIX, is not a directory."
exit 1
@@ -120,18 +114,18 @@ if [[ -f "$ACCUMULO_CONF_DIR/masters" ]]; then
MASTER1=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters" | head -1)
fi
-if [ -z "${MONITOR}" ] ; then
+if [[ -z "${MONITOR}" ]] ; then
MONITOR=$MASTER1
- if [ -f "$ACCUMULO_CONF_DIR/monitor" ]; then
+ if [[ -f "$ACCUMULO_CONF_DIR/monitor" ]]; then
MONITOR=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/monitor" | head -1)
fi
- if [ -z "${MONITOR}" ] ; then
+ if [[ -z "${MONITOR}" ]] ; then
echo "Could not infer a Monitor role. You need to either define the MONITOR env variable, define \"${ACCUMULO_CONF_DIR}/monitor\", or make sure \"${ACCUMULO_CONF_DIR}/masters\" is non-empty."
exit 1
fi
fi
-if [ ! -f "$ACCUMULO_CONF_DIR/tracers" -a -z "${ACCUMULO_VERIFY_ONLY}" ]; then
- if [ -z "${MASTER1}" ] ; then
+if [[ ! -f "$ACCUMULO_CONF_DIR/tracers" && -z "${ACCUMULO_VERIFY_ONLY}" ]]; then
+ if [[ -z "${MASTER1}" ]] ; then
echo "Could not find a master node to use as a default for the tracer role. Either set up \"${ACCUMULO_CONF_DIR}/tracers\" or make sure \"${ACCUMULO_CONF_DIR}/masters\" is non-empty."
exit 1
else
@@ -140,8 +134,8 @@ if [ ! -f "$ACCUMULO_CONF_DIR/tracers" -a -z "${ACCUMULO_VERIFY_ONLY}" ]; then
fi
-if [ ! -f "$ACCUMULO_CONF_DIR/gc" -a -z "${ACCUMULO_VERIFY_ONLY}" ]; then
- if [ -z "${MASTER1}" ] ; then
+if [[ ! -f "$ACCUMULO_CONF_DIR/gc" && -z "${ACCUMULO_VERIFY_ONLY}" ]]; then
+ if [[ -z "${MASTER1}" ]] ; then
echo "Could not infer a GC role. You need to either set up \"${ACCUMULO_CONF_DIR}/gc\" or make sure \"${ACCUMULO_CONF_DIR}/masters\" is non-empty."
exit 1
else
@@ -161,15 +155,15 @@ export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-1}
export ACCUMULO_MONITOR_BIND_ALL=${ACCUMULO_MONITOR_BIND_ALL:-"false"}
# Check for jaas.conf configuration
-if [ -z ${ACCUMULO_JAAS_CONF} ]; then
- if [ -f ${ACCUMULO_CONF_DIR}/jaas.conf ]; then
+if [[ -z ${ACCUMULO_JAAS_CONF} ]]; then
+ if [[ -f ${ACCUMULO_CONF_DIR}/jaas.conf ]]; then
export ACCUMULO_JAAS_CONF=${ACCUMULO_CONF_DIR}/jaas.conf
fi
fi
# Check for krb5.conf configuration
-if [ -z ${ACCUMULO_KRB5_CONF} ]; then
- if [ -f ${ACCUMULO_CONF_DIR}/krb5.conf ]; then
+if [[ -z ${ACCUMULO_KRB5_CONF} ]]; then
+ if [[ -f ${ACCUMULO_CONF_DIR}/krb5.conf ]]; then
export ACCUMULO_KRB5_CONF=${ACCUMULO_CONF_DIR}/krb5.conf
fi
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/generate_monitor_certificate.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/generate_monitor_certificate.sh b/assemble/bin/generate_monitor_certificate.sh
index edd4159..5e5745f 100755
--- a/assemble/bin/generate_monitor_certificate.sh
+++ b/assemble/bin/generate_monitor_certificate.sh
@@ -18,11 +18,11 @@
# 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")"
+ 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 )"
+bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
# Stop: Resolve Script Directory
. "$bin"/config.sh
@@ -34,33 +34,33 @@ KEYSTOREPATH="$ACCUMULO_HOME/conf/keystore.jks"
TRUSTSTOREPATH="$ACCUMULO_HOME/conf/cacerts.jks"
CERTPATH="$ACCUMULO_HOME/conf/server.cer"
-if [ -e "$KEYSTOREPATH" ]; then
- rm -i $KEYSTOREPATH
- if [ -e "$KEYSTOREPATH" ]; then
+if [[ -e "$KEYSTOREPATH" ]]; then
+ rm -i "$KEYSTOREPATH"
+ if [[ -e "$KEYSTOREPATH" ]]; then
echo "KeyStore already exists, exiting"
exit 1
fi
fi
-if [ -e "$TRUSTSTOREPATH" ]; then
- rm -i $TRUSTSTOREPATH
- if [ -e "$TRUSTSTOREPATH" ]; then
+if [[ -e "$TRUSTSTOREPATH" ]]; then
+ rm -i "$TRUSTSTOREPATH"
+ if [[ -e "$TRUSTSTOREPATH" ]]; then
echo "TrustStore already exists, exiting"
exit 2
fi
fi
-if [ -e "$CERTPATH" ]; then
- rm -i $CERTPATH
- if [ -e "$CERTPATH" ]; then
+if [[ -e "$CERTPATH" ]]; then
+ rm -i "$CERTPATH"
+ if [[ -e "$CERTPATH" ]]; then
echo "Certificate already exists, exiting"
exit 3
fi
fi
-${JAVA_HOME}/bin/keytool -genkey -alias $ALIAS -keyalg RSA -keypass $KEYPASS -storepass $KEYPASS -keystore $KEYSTOREPATH
-${JAVA_HOME}/bin/keytool -export -alias $ALIAS -storepass $KEYPASS -file $CERTPATH -keystore $KEYSTOREPATH
-echo "yes" | ${JAVA_HOME}/bin/keytool -import -v -trustcacerts -alias $ALIAS -file $CERTPATH -keystore $TRUSTSTOREPATH -storepass $STOREPASS
+"${JAVA_HOME}/bin/keytool" -genkey -alias "$ALIAS" -keyalg RSA -keypass "$KEYPASS" -storepass "$KEYPASS" -keystore "$KEYSTOREPATH"
+"${JAVA_HOME}/bin/keytool" -export -alias "$ALIAS" -storepass "$KEYPASS" -file "$CERTPATH" -keystore "$KEYSTOREPATH"
+"${JAVA_HOME}/bin/keytool" -import -v -trustcacerts -alias "$ALIAS" -file "$CERTPATH" -keystore "$TRUSTSTOREPATH" -storepass "$STOREPASS" <<< "yes"
echo
echo "keystore and truststore generated. now add the following to accumulo-site.xml:"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/start-all.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/start-all.sh b/assemble/bin/start-all.sh
index b71ba70..cebbd8c 100755
--- a/assemble/bin/start-all.sh
+++ b/assemble/bin/start-all.sh
@@ -64,14 +64,14 @@ if [ "$1" != "--notSlaves" ]; then
fi
${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
-for master in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"`; do
+for master in $(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters"); do
${bin}/start-server.sh $master master
done
-for gc in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"`; do
+for gc in $(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/gc"); do
${bin}/start-server.sh $gc gc "garbage collector"
done
-for tracer in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/tracers"`; do
+for tracer in $(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/tracers"); do
${bin}/start-server.sh $tracer tracer
done
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/start-here.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/start-here.sh b/assemble/bin/start-here.sh
index 9abdb38..7d70e97 100755
--- a/assemble/bin/start-here.sh
+++ b/assemble/bin/start-here.sh
@@ -32,47 +32,46 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
. "$bin"/config.sh
IFCONFIG=/sbin/ifconfig
-if [ ! -x $IFCONFIG ]; then
- IFCONFIG='/bin/netstat -ie'
-fi
-ip=$($IFCONFIG 2>/dev/null| grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1)
-if [ $? != 0 ]; then
- ip=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
+[[ ! -x $IFCONFIG ]] && IFCONFIG='/bin/netstat -ie'
+
+IP=$($IFCONFIG 2>/dev/null| grep "inet[^6]" | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1)
+if [[ $? != 0 ]]; then
+ IP=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
fi
-HOSTS="$(hostname -a 2> /dev/null) $(hostname) localhost 127.0.0.1 $ip"
+HOSTS="$(hostname -a 2> /dev/null) $(hostname) localhost 127.0.0.1 $IP"
for host in $HOSTS; do
- if grep -q "^${host}\$" $ACCUMULO_CONF_DIR/slaves; then
- ${bin}/start-server.sh $host tserver "tablet server"
+ if grep -q "^${host}\$" "$ACCUMULO_CONF_DIR/slaves"; then
+ "${bin}/start-server.sh" "$host" tserver "tablet server"
break
fi
done
for host in $HOSTS; do
- if grep -q "^${host}\$" $ACCUMULO_CONF_DIR/masters; then
- ${bin}/accumulo org.apache.accumulo.master.state.SetGoalState NORMAL
- ${bin}/start-server.sh $host master
+ if grep -q "^${host}\$" "$ACCUMULO_CONF_DIR/masters"; then
+ "${bin}/accumulo" org.apache.accumulo.master.state.SetGoalState NORMAL
+ "${bin}/start-server.sh" "$host" master
break
fi
done
for host in $HOSTS; do
- if grep -q "^${host}\$" $ACCUMULO_CONF_DIR/gc; then
- ${bin}/start-server.sh $host gc "garbage collector"
+ if grep -q "^${host}\$" "$ACCUMULO_CONF_DIR/gc"; then
+ "${bin}/start-server.sh" "$host" gc "garbage collector"
break
fi
done
for host in $HOSTS; do
- if [ ${host} = "${MONITOR}" ]; then
- ${bin}/start-server.sh $MONITOR monitor
+ if [[ $host == "$MONITOR" ]]; then
+ "${bin}/start-server.sh" "$MONITOR" monitor
break
fi
done
for host in $HOSTS; do
- if grep -q "^${host}\$" $ACCUMULO_CONF_DIR/tracers; then
- ${bin}/start-server.sh $host tracer
+ if grep -q "^${host}\$" "$ACCUMULO_CONF_DIR/tracers"; then
+ "${bin}/start-server.sh" "$host" tracer
break
fi
done
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/start-server.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/start-server.sh b/assemble/bin/start-server.sh
index 62ad91d..2a2d96d 100755
--- a/assemble/bin/start-server.sh
+++ b/assemble/bin/start-server.sh
@@ -17,7 +17,7 @@
# Start: Resolve Script Directory
SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+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
@@ -30,52 +30,48 @@ script=$( basename "$SOURCE" )
HOST="$1"
host "$1" >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
+if [[ $? != 0 ]]; then
LOGHOST="$1"
else
LOGHOST=$(host "$1" | head -1 | cut -d' ' -f1)
fi
-ADDRESS="$1"
-SERVICE="$2"
-LONGNAME="$3"
-if [ -z "$LONGNAME" ]; then
- LONGNAME="$2"
-fi
-SLAVES=$( wc -l < ${ACCUMULO_CONF_DIR}/slaves )
+ADDRESS=$1
+SERVICE=$2
+LONGNAME=$3
+[[ -z $LONGNAME ]] && LONGNAME=$2
+
+SLAVES=$(wc -l "${ACCUMULO_CONF_DIR}/slaves")
IFCONFIG=/sbin/ifconfig
-if [ ! -x $IFCONFIG ]; then
- IFCONFIG='/bin/netstat -ie'
-fi
+[[ ! -x $IFCONFIG ]] && IFCONFIG='/bin/netstat -ie'
# ACCUMULO-1985 Allow monitor to bind on all interfaces
-if [ ${SERVICE} == "monitor" -a ${ACCUMULO_MONITOR_BIND_ALL} == "true" ]; then
+if [[ $SERVICE == monitor && $ACCUMULO_MONITOR_BIND_ALL == true ]]; then
ADDRESS="0.0.0.0"
fi
-ip=$($IFCONFIG 2>/dev/null| grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1)
-if [ $? != 0 ]
-then
- ip=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
+IP=$($IFCONFIG 2>/dev/null| grep "inet[^6]" | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1)
+if [[ $? != 0 ]] ; then
+ IP=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
fi
-if [ "$HOST" = "localhost" -o "$HOST" = "`hostname`" -o "$HOST" = "$ip" ]; then
+if [[ $HOST == localhost || $HOST == "$(hostname)" || $HOST = "$IP" ]]; then
PID=$(ps -ef | egrep ${ACCUMULO_HOME}/.*/accumulo.*.jar | grep "Main $SERVICE" | grep -v grep | awk {'print $2'} | head -1)
else
- PID=$($SSH $HOST ps -ef | egrep ${ACCUMULO_HOME}/.*/accumulo.*.jar | grep "Main $SERVICE" | grep -v grep | awk {'print $2'} | head -1)
+ PID=$($SSH "$HOST" ps -ef | egrep "${ACCUMULO_HOME}/.*/accumulo.*.jar" | grep "Main $SERVICE" | grep -v grep | awk {'print $2'} | head -1)
fi
-if [ -z "$PID" ]; then
+if [[ -z "$PID" ]]; then
echo "Starting $LONGNAME on $HOST"
- if [ "$HOST" = "localhost" -o "$HOST" = "`hostname`" -o "$HOST" = "$ip" ]; then
- ${bin}/accumulo ${SERVICE} --address ${ADDRESS} >${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.out 2>${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.err &
+ if [[ $HOST == localhost || $HOST == "$(hostname)" || $HOST = "$IP" ]]; then
+ "${bin}/accumulo" "${SERVICE}" --address "${ADDRESS}" >"${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.out" 2>"${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.err" &
MAX_FILES_OPEN=$(ulimit -n)
else
- $SSH $HOST "bash -c 'exec nohup ${bin}/accumulo ${SERVICE} --address ${ADDRESS} >${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.out 2>${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.err' &"
- MAX_FILES_OPEN=$($SSH $HOST "/usr/bin/env bash -c 'ulimit -n'")
+ $SSH "$HOST" "bash -c 'exec nohup ${bin}/accumulo ${SERVICE} --address ${ADDRESS} >${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.out 2>${ACCUMULO_LOG_DIR}/${SERVICE}_${LOGHOST}.err' &"
+ MAX_FILES_OPEN=$($SSH "$HOST" "/usr/bin/env bash -c 'ulimit -n'")
fi
- if [ -n "$MAX_FILES_OPEN" ] && [ -n "$SLAVES" ] ; then
+ if [[ -n $MAX_FILES_OPEN && -n $SLAVES ]] ; then
MAX_FILES_RECOMMENDED=${MAX_FILES_RECOMMENDED:-32768}
if (( SLAVES > 10 )) && (( MAX_FILES_OPEN < MAX_FILES_RECOMMENDED ))
then
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/stop-all.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/stop-all.sh b/assemble/bin/stop-all.sh
index 3bd30bd..4bf06c0 100755
--- a/assemble/bin/stop-all.sh
+++ b/assemble/bin/stop-all.sh
@@ -18,12 +18,12 @@
# 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")"
+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 )"
+bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
# Stop: Resolve Script Directory
. "$bin"/config.sh
@@ -31,7 +31,7 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo "Stopping accumulo services..."
${bin}/accumulo admin "$@" stopAll
-if [ $? -ne 0 ]; then
+if [[ $? != 0 ]]; then
echo "Invalid password or unable to connect to the master"
echo "Initiating forced shutdown in 15 seconds (Ctrl-C to abort)"
sleep 10
@@ -45,24 +45,24 @@ sleep 5
#look for master and gc processes not killed by 'admin stopAll'
for signal in TERM KILL ; do
- for master in `grep -v '^#' "$ACCUMULO_CONF_DIR/masters"`; do
- ${bin}/stop-server.sh $master "$ACCUMULO_HOME/lib/accumulo-start.*.jar" master $signal
+ for master in $(grep -v '^#' "$ACCUMULO_CONF_DIR/masters"); do
+ "${bin}/stop-server.sh" "$master" "$ACCUMULO_HOME/lib/accumulo-start.*.jar" master $signal
done
- for gc in `grep -v '^#' "$ACCUMULO_CONF_DIR/gc"`; do
- ${bin}/stop-server.sh "$gc" "$ACCUMULO_HOME/lib/accumulo-start.*.jar" gc $signal
+ for gc in $(grep -v '^#' "$ACCUMULO_CONF_DIR/gc"); do
+ "${bin}/stop-server.sh" "$gc" "$ACCUMULO_HOME/lib/accumulo-start.*.jar" gc $signal
done
- ${bin}/stop-server.sh "$MONITOR" "$ACCUMULO_HOME/.*/accumulo-start.*.jar" monitor $signal
+ "${bin}/stop-server.sh" "$MONITOR" "$ACCUMULO_HOME/.*/accumulo-start.*.jar" monitor $signal
- for tracer in `egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/tracers"`; do
- ${bin}/stop-server.sh $tracer "$ACCUMULO_HOME/.*/accumulo-start.*.jar" tracer $signal
+ for tracer in $(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/tracers"); do
+ "${bin}/stop-server.sh" "$tracer" "$ACCUMULO_HOME/.*/accumulo-start.*.jar" tracer $signal
done
done
# stop tserver still running
-${bin}/tdown.sh
+"${bin}/tdown.sh"
echo "Cleaning all server entries in ZooKeeper"
-$ACCUMULO_HOME/bin/accumulo org.apache.accumulo.server.util.ZooZap -master -tservers -tracers
+"$ACCUMULO_HOME/bin/accumulo" org.apache.accumulo.server.util.ZooZap -master -tservers -tracers
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/stop-here.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/stop-here.sh b/assemble/bin/stop-here.sh
index 4d5533a..fb5bb7d 100755
--- a/assemble/bin/stop-here.sh
+++ b/assemble/bin/stop-here.sh
@@ -35,26 +35,24 @@ ACCUMULO="$ACCUMULO_HOME/lib/accumulo-start.jar"
# Determine hostname without errors to user
HOSTNAME=$(hostname -a 2> /dev/null | head -1)
-if [ -z ${HOSTNAME} ]; then
- HOSTNAME=$(hostname)
-fi
+[[ -z ${HOSTNAME} ]] && HOSTNAME=$(hostname)
-if egrep -q localhost\|127.0.0.1 $ACCUMULO_CONF_DIR/slaves; then
- $bin/accumulo admin stop localhost
+if egrep -q localhost\|127.0.0.1 "$ACCUMULO_CONF_DIR/slaves"; then
+ "$bin/accumulo" admin stop localhost
else
for host in "$(hostname -a 2> /dev/null) $(hostname)"; do
if grep -q ${host} $ACCUMULO_CONF_DIR/slaves; then
- ${bin}/accumulo admin stop $host
+ "${bin}/accumulo" admin stop "$host"
fi
done
fi
for signal in TERM KILL; do
for svc in tserver gc master monitor logger tracer; do
- PID=$(ps -ef | egrep ${ACCUMULO} | grep "Main $svc" | grep -v grep | grep -v stop-here.sh | awk '{print $2}' | head -1)
- if [ ! -z $PID ]; then
+ PID=$(ps -ef | egrep "${ACCUMULO}" | grep "Main $svc" | grep -v grep | grep -v stop-here.sh | awk '{print $2}' | head -1)
+ if [[ -n $PID ]]; then
echo "Stopping ${svc} on ${HOSTNAME} with signal ${signal}"
- kill -s ${signal} ${PID}
+ kill -s ${signal} "${PID}"
fi
done
done
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/stop-server.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/stop-server.sh b/assemble/bin/stop-server.sh
index 6fbe0af..52696af 100755
--- a/assemble/bin/stop-server.sh
+++ b/assemble/bin/stop-server.sh
@@ -18,11 +18,11 @@
# 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")"
+ 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 )"
+bin=$( cd -P "$( dirname "$SOURCE" )" && pwd )
# Stop: Resolve Script Directory
. "$bin"/config.sh
@@ -30,27 +30,25 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
HOST=$1
IFCONFIG=/sbin/ifconfig
-if [ ! -x $IFCONFIG ]
-then
- IFCONFIG='/bin/netstat -ie'
-fi
-ip=$($IFCONFIG 2>/dev/null| grep inet[^6] | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1)
-if [ $? != 0 ]
+[[ ! -x $IFCONFIG ]] && IFCONFIG='/bin/netstat -ie'
+
+IP=$($IFCONFIG 2>/dev/null| grep "inet[^6]" | awk '{print $2}' | sed 's/addr://' | grep -v 0.0.0.0 | grep -v 127.0.0.1 | head -n 1)
+if [[ $? != 0 ]]
then
- ip=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
+ IP=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
fi
# only stop if there's not one already running
-if [ "$HOST" = "localhost" -o "$HOST" = "`hostname`" -o "$HOST" = "$ip" ]; then
+if [[ $HOST == localhost || $HOST = "$(hostname)" || $HOST = "$IP" ]] ; then
PID=$(ps -ef | grep "$ACCUMULO_HOME" | egrep ${2} | grep "Main ${3}" | grep -v grep | grep -v ssh | grep -v stop-server.sh | awk {'print $2'} | head -1)
- if [ ! -z $PID ]; then
+ if [[ -n $PID ]]; then
echo "Stopping ${3} on $1";
- kill -s ${4} ${PID} 2>/dev/null
+ kill -s "${4}" "${PID}" 2>/dev/null
fi;
else
- PID=$(ssh -q -o 'ConnectTimeout 8' $1 "ps -ef | grep \"$ACCUMULO_HOME\" | egrep '${2}' | grep 'Main ${3}' | grep -v grep | grep -v ssh | grep -v stop-server.sh" | awk {'print $2'} | head -1)
- if [ ! -z $PID ]; then
+ PID=$(ssh -q -o 'ConnectTimeout 8' "$1" "ps -ef | grep \"$ACCUMULO_HOME\" | egrep '${2}' | grep 'Main ${3}' | grep -v grep | grep -v ssh | grep -v stop-server.sh" | awk {'print $2'} | head -1)
+ if [[ -n $PID ]]; then
echo "Stopping ${3} on $1";
- ssh -q -o 'ConnectTimeout 8' $1 "kill -s ${4} ${PID} 2>/dev/null"
+ ssh -q -o 'ConnectTimeout 8' "$1" "kill -s ${4} ${PID} 2>/dev/null"
fi;
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/tool.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/tool.sh b/assemble/bin/tool.sh
index 8126b3b..701c15f 100755
--- a/assemble/bin/tool.sh
+++ b/assemble/bin/tool.sh
@@ -17,7 +17,7 @@
# Start: Resolve Script Directory
SOURCE="${BASH_SOURCE[0]}"
-while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+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
@@ -27,17 +27,17 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
. "$bin"/config.sh
-if [ -z "$HADOOP_PREFIX" ] ; then
+if [[ -z "$HADOOP_PREFIX" ]] ; then
echo "HADOOP_PREFIX is not set. Please make sure it's set globally or in conf/accumulo-env.sh"
exit 1
fi
-if [ -z "$ZOOKEEPER_HOME" ] ; then
+if [[ -z "$ZOOKEEPER_HOME" ]] ; then
echo "ZOOKEEPER_HOME is not set. Please make sure it's set globally or in conf/accumulo-env.sh"
exit 1
fi
ZOOKEEPER_CMD='ls -1 $ZOOKEEPER_HOME/zookeeper-[0-9]*[^csn].jar '
-if [ `eval $ZOOKEEPER_CMD | wc -l` != "1" ] ; then
+if [[ $(eval $ZOOKEEPER_CMD | wc -l) != "1" ]] ; then
echo "Not exactly one zookeeper jar in $ZOOKEEPER_HOME"
exit 1
fi
@@ -81,7 +81,7 @@ for jar in $USERJARS; do
done
export HADOOP_CLASSPATH="$H_JARS:$HADOOP_CLASSPATH"
-if [ -z "$CLASSNAME" -o -z "$TOOLJAR" ]; then
+if [[ -z "$CLASSNAME" || -z "$TOOLJAR" ]]; then
echo "Usage: tool.sh path/to/myTool.jar my.tool.class.Name [-libjars my1.jar,my2.jar]" 1>&2
exit 1
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/bin/tup.sh
----------------------------------------------------------------------
diff --git a/assemble/bin/tup.sh b/assemble/bin/tup.sh
index b26def5..d89896d 100755
--- a/assemble/bin/tup.sh
+++ b/assemble/bin/tup.sh
@@ -32,11 +32,10 @@ SLAVES=$ACCUMULO_CONF_DIR/slaves
echo -n "Starting tablet servers ..."
count=1
-for server in `egrep -v '(^#|^\s*$)' "${SLAVES}"`; do
+for server in $(egrep -v '(^#|^\s*$)' "${SLAVES}"); do
echo -n "."
${bin}/start-server.sh $server tserver "tablet server" &
- let count++
- if [ $(( ${count} % 72 )) -eq 0 ] ;
+ if (( ++count % 72 == 0 )) ;
then
echo
wait
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/build.sh
----------------------------------------------------------------------
diff --git a/assemble/build.sh b/assemble/build.sh
index 5f65419..78ce6ca 100755
--- a/assemble/build.sh
+++ b/assemble/build.sh
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -15,27 +15,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-loc=`dirname "$0"`
-loc=`cd "$loc/.."; pwd`
+loc=$(dirname "$0")
+loc=$(cd "$loc/.."; pwd)
cd "$loc"
fail() {
- echo ' ' $@
+ echo ' ' "$@"
exit 1
}
run() {
- echo $@
- eval $@
- if [ $? -ne 0 ]
- then
- fail $@ fails
+ echo "$@"
+ eval "$@"
+ if [[ $? != 0 ]] ; then
+ fail "$@" fails
fi
}
runAt() {
- ( cd $1 ; echo in `pwd`; shift ; run $@ ) || fail
+ ( cd "$1" ; echo "in $(pwd)"; shift ; run "$@" ) || fail
}
cacheGPG() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/assemble/conf/templates/accumulo-env.sh
----------------------------------------------------------------------
diff --git a/assemble/conf/templates/accumulo-env.sh b/assemble/conf/templates/accumulo-env.sh
index e136a3f..1ea1834 100644
--- a/assemble/conf/templates/accumulo-env.sh
+++ b/assemble/conf/templates/accumulo-env.sh
@@ -27,8 +27,7 @@
### you may want to use smaller values, especially when running everything
### on a single machine.
###
-if [ -z "$HADOOP_HOME" ]
-then
+if [[ -z $HADOOP_HOME ]] ; then
test -z "$HADOOP_PREFIX" && export HADOOP_PREFIX=/path/to/hadoop
else
HADOOP_PREFIX="$HADOOP_HOME"
@@ -38,12 +37,12 @@ fi
# hadoop-1.2:
# test -z "$HADOOP_CONF_DIR" && export HADOOP_CONF_DIR="$HADOOP_PREFIX/conf"
# hadoop-2.0:
-test -z "$HADOOP_CONF_DIR" && export HADOOP_CONF_DIR="$HADOOP_PREFIX/etc/hadoop"
+test -z "$HADOOP_CONF_DIR" && export HADOOP_CONF_DIR="$HADOOP_PREFIX/etc/hadoop"
test -z "$JAVA_HOME" && export JAVA_HOME=/path/to/java
test -z "$ZOOKEEPER_HOME" && export ZOOKEEPER_HOME=/path/to/zookeeper
test -z "$ACCUMULO_LOG_DIR" && export ACCUMULO_LOG_DIR=$ACCUMULO_HOME/logs
-if [ -f ${ACCUMULO_CONF_DIR}/accumulo.policy ]
+if [[ -f ${ACCUMULO_CONF_DIR}/accumulo.policy ]]
then
POLICY="-Djava.security.manager -Djava.security.policy=${ACCUMULO_CONF_DIR}/accumulo.policy"
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/core/src/main/scripts/generate-protobuf.sh
----------------------------------------------------------------------
diff --git a/core/src/main/scripts/generate-protobuf.sh b/core/src/main/scripts/generate-protobuf.sh
index 9a3b08a..cf104ad 100755
--- a/core/src/main/scripts/generate-protobuf.sh
+++ b/core/src/main/scripts/generate-protobuf.sh
@@ -22,23 +22,23 @@
# In other scripts, set the variables that diverge from the defaults below, then call this script.
# Leave the BUILD_DIR and FINAL_DIR alone for Maven builds.
# ========================================================================================================================
-[ -z $REQUIRED_PROTOC_VERSION ] && REQUIRED_PROTOC_VERSION='libprotoc 2.5.0'
-[ -z $BUILD_DIR ] && BUILD_DIR='target/proto'
-[ -z $FINAL_DIR ] && FINAL_DIR='src/main'
+[[ -z $REQUIRED_PROTOC_VERSION ]] && REQUIRED_PROTOC_VERSION='libprotoc 2.5.0'
+[[ -z $BUILD_DIR ]] && BUILD_DIR='target/proto'
+[[ -z $FINAL_DIR ]] && FINAL_DIR='src/main'
# ========================================================================================================================
fail() {
- echo $@
+ echo "$@"
exit 1
}
# Test to see if we have thrift installed
VERSION=$(protoc --version 2>/dev/null | grep -F "${REQUIRED_PROTOC_VERSION}" | wc -l)
-if [ "$VERSION" -ne 1 ] ; then
+if [[ $VERSION != 1 ]] ; then
# Nope: bail
echo "****************************************************"
echo "*** protoc is not available"
- echo "*** expecting 'protoc -version' to return ${REQUIRED_PROTOC_VERSION}"
+ echo "*** expecting 'protoc --version' to return ${REQUIRED_PROTOC_VERSION}"
echo "*** generated code will not be updated"
fail "****************************************************"
fi
@@ -59,10 +59,10 @@ LINE_NOTATION=" *"
SUFFIX="
*/"
FILE_SUFFIX=(.java)
-
-for file in ${FILE_SUFFIX[@]}; do
+
+for file in "${FILE_SUFFIX[@]}"; do
for f in $(find $BUILD_DIR/ -name "*$file"); do
- cat - $f >${f}-with-license <<EOF
+ cat - "$f" > "${f}-with-license" <<EOF
${PREFIX}${LINE_NOTATION} Licensed to the Apache Software Foundation (ASF) under one or more
${LINE_NOTATION} contributor license agreements. See the NOTICE file distributed with
${LINE_NOTATION} this work for additional information regarding copyright ownership.
@@ -86,11 +86,11 @@ SDIR="${BUILD_DIR}/org/apache/accumulo/core/replication/proto"
DDIR="${FINAL_DIR}/java/org/apache/accumulo/core/replication/proto"
FILE_SUFFIX=(.java)
mkdir -p "$DDIR"
-for file in ${FILE_SUFFIX[@]}; do
- for f in `find $SDIR -name *$file`; do
- DEST="$DDIR/`basename $f`"
+for file in "${FILE_SUFFIX[@]}"; do
+ for f in $(find $SDIR -name *$file); do
+ DEST=$DDIR/$(basename "$f")
if ! cmp -s "${f}-with-license" "${DEST}" ; then
- echo cp -f "${f}-with-license" "${DEST}"
+ echo cp -f "${f}-with-license" "${DEST}"
cp -f "${f}-with-license" "${DEST}" || fail unable to copy files to java workspace
fi
done
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/core/src/main/scripts/generate-thrift.sh
----------------------------------------------------------------------
diff --git a/core/src/main/scripts/generate-thrift.sh b/core/src/main/scripts/generate-thrift.sh
index ee51b11..388a23d 100755
--- a/core/src/main/scripts/generate-thrift.sh
+++ b/core/src/main/scripts/generate-thrift.sh
@@ -26,23 +26,23 @@
# INCLUDED_MODULES should be an array that includes other Maven modules with src/main/thrift directories
# Use INCLUDED_MODULES=(-) in calling scripts that require no other modules
# ========================================================================================================================
-[ -z $REQUIRED_THRIFT_VERSION ] && REQUIRED_THRIFT_VERSION='0.9'
-[ -z $INCLUDED_MODULES ] && INCLUDED_MODULES=(../trace)
-[ -z $BASE_OUTPUT_PACKAGE ] && BASE_OUTPUT_PACKAGE='org.apache.accumulo.core'
-[ -z $PACKAGES_TO_GENERATE ] && PACKAGES_TO_GENERATE=(gc master tabletserver security client.impl data replication)
-[ -z $BUILD_DIR ] && BUILD_DIR='target'
-[ -z $LANGUAGES_TO_GENERATE ] && LANGUAGES_TO_GENERATE=(java)
-[ -z $FINAL_DIR ] && FINAL_DIR='src/main'
+[[ -z $REQUIRED_THRIFT_VERSION ]] && REQUIRED_THRIFT_VERSION='0.9'
+[[ -z $INCLUDED_MODULES ]] && INCLUDED_MODULES=(../trace)
+[[ -z $BASE_OUTPUT_PACKAGE ]] && BASE_OUTPUT_PACKAGE='org.apache.accumulo.core'
+[[ -z $PACKAGES_TO_GENERATE ]] && PACKAGES_TO_GENERATE=(gc master tabletserver security client.impl data replication)
+[[ -z $BUILD_DIR ]] && BUILD_DIR='target'
+[[ -z $LANGUAGES_TO_GENERATE ]] && LANGUAGES_TO_GENERATE=(java)
+[[ -z $FINAL_DIR ]] && FINAL_DIR='src/main'
# ========================================================================================================================
fail() {
- echo $@
+ echo "$@"
exit 1
}
# Test to see if we have thrift installed
VERSION=$(thrift -version 2>/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" | wc -l)
-if [ "$VERSION" -ne 1 ] ; then
+if [[ $VERSION != 1 ]] ; then
# Nope: bail
echo "****************************************************"
echo "*** thrift is not available"
@@ -65,10 +65,10 @@ THRIFT_ARGS="${THRIFT_ARGS} -o $BUILD_DIR"
mkdir -p $BUILD_DIR
rm -rf $BUILD_DIR/gen-java
for f in src/main/thrift/*.thrift; do
- thrift ${THRIFT_ARGS} --gen java $f || fail unable to generate java thrift classes
- thrift ${THRIFT_ARGS} --gen py $f || fail unable to generate python thrift classes
- thrift ${THRIFT_ARGS} --gen rb $f || fail unable to generate ruby thrift classes
- thrift ${THRIFT_ARGS} --gen cpp $f || fail unable to generate cpp thrift classes
+ thrift "${THRIFT_ARGS}" --gen java "$f" || fail unable to generate java thrift classes
+ thrift "${THRIFT_ARGS}" --gen py "$f" || fail unable to generate python thrift classes
+ thrift "${THRIFT_ARGS}" --gen rb "$f" || fail unable to generate ruby thrift classes
+ thrift "${THRIFT_ARGS}" --gen cpp "$f" || fail unable to generate cpp thrift classes
done
# For all generated thrift code, suppress all warnings and add the LICENSE header
@@ -110,9 +110,9 @@ for lang in "${LANGUAGES_TO_GENERATE[@]}"; do
;;
esac
- for file in ${FILE_SUFFIX[@]}; do
+ for file in "${FILE_SUFFIX[@]}"; do
for f in $(find $BUILD_DIR/gen-$lang -name "*$file"); do
- cat - $f >${f}-with-license <<EOF
+ cat - "$f" > "${f}-with-license" <<EOF
${PREFIX}${LINE_NOTATION} Licensed to the Apache Software Foundation (ASF) under one or more
${LINE_NOTATION} contributor license agreements. See the NOTICE file distributed with
${LINE_NOTATION} this work for additional information regarding copyright ownership.
@@ -135,7 +135,7 @@ done
# For every generated java file, compare it with the version-controlled one, and copy the ones that have changed into place
for d in "${PACKAGES_TO_GENERATE[@]}"; do
for lang in "${LANGUAGES_TO_GENERATE[@]}"; do
- case $lang in
+ case "$lang" in
cpp)
SDIR="${BUILD_DIR}/gen-$lang/"
DDIR="${FINAL_DIR}/cpp/"
@@ -161,9 +161,9 @@ for d in "${PACKAGES_TO_GENERATE[@]}"; do
;;
esac
mkdir -p "$DDIR"
- for file in ${FILE_SUFFIX[@]}; do
- for f in `find $SDIR -name *$file`; do
- DEST="$DDIR/`basename $f`"
+ for file in "${FILE_SUFFIX[@]}"; do
+ for f in $(find $SDIR -name *$file); do
+ DEST="$DDIR/$(basename $f)"
if ! cmp -s "${f}-with-license" "${DEST}" ; then
echo cp -f "${f}-with-license" "${DEST}"
cp -f "${f}-with-license" "${DEST}" || fail unable to copy files to java workspace
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/proxy/examples/python/TestClient.py
----------------------------------------------------------------------
diff --git a/proxy/examples/python/TestClient.py b/proxy/examples/python/TestClient.py
index 5509ded..f104387 100644
--- a/proxy/examples/python/TestClient.py
+++ b/proxy/examples/python/TestClient.py
@@ -1,4 +1,5 @@
-#!/usr/bin/env python
+#! /usr/bin/env python
+
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/start/src/test/shell/makeTestJars.sh
----------------------------------------------------------------------
diff --git a/start/src/test/shell/makeTestJars.sh b/start/src/test/shell/makeTestJars.sh
index 13018b1..d3b92a1 100755
--- a/start/src/test/shell/makeTestJars.sh
+++ b/start/src/test/shell/makeTestJars.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -16,7 +16,7 @@
# limitations under the License.
-cd $ACCUMULO_HOME/src/start
+cd "$ACCUMULO_HOME/src/start"
for x in A B C
do
sed "s/testX/test$x/" < src/test/java/test/TestTemplate > src/test/java/test/TestObject.java
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/src/test/scripts/run-test.sh
----------------------------------------------------------------------
diff --git a/test/src/test/scripts/run-test.sh b/test/src/test/scripts/run-test.sh
index 02a5090..0e9670f 100755
--- a/test/src/test/scripts/run-test.sh
+++ b/test/src/test/scripts/run-test.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#! /usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -16,27 +16,27 @@
# limitations under the License.
-if [ ! -n "$1" ]; then
- echo "Usage: `basename $0` TestClass1[,TestClass2,TestClass3] ..."
- echo " `basename $0` \"Prefix*IT[,Prefix2*IT]\" ..."
- echo " `basename $0` \"MyIT#method1+method2\" ..."
+if [[ -z $1 ]]; then
+ echo "Usage: $(basename $0) TestClass1[,TestClass2,TestClass3] ..."
+ echo " $(basename $0) \"Prefix*IT[,Prefix2*IT]\" ..."
+ echo " $(basename $0) \"MyIT#method1+method2\" ..."
exit 1
fi
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
# Stop: Resolve Script Directory
-cd $bin/..
+cd "$bin/.."
tests=$1
shift
# Let the user provide additional maven options (like -DforkCount=2)
-mvn verify -Dit.test=$tests -Dtest=testnamethatdoesntexist -DfailIfNoTests=false $@
+mvn verify -Dit.test="$tests" -Dtest=testnamethatdoesntexist -DfailIfNoTests=false "$@"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/analyze-missing.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/analyze-missing.sh b/test/system/continuous/analyze-missing.sh
index 62ad15b..e2cfbb1 100755
--- a/test/system/continuous/analyze-missing.sh
+++ b/test/system/continuous/analyze-missing.sh
@@ -17,7 +17,7 @@
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-$ACCUMULO_HOME/test/system/continuous/}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-./analyze-missing.pl $ACCUMULO_HOME $CONTINUOUS_LOG_DIR $USER $PASS
+./analyze-missing.pl "$ACCUMULO_HOME" "$CONTINUOUS_LOG_DIR" "$USER" "$PASS"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/continuous-env.sh.example
----------------------------------------------------------------------
diff --git a/test/system/continuous/continuous-env.sh.example b/test/system/continuous/continuous-env.sh.example
index d3fdd62..8993782 100644
--- a/test/system/continuous/continuous-env.sh.example
+++ b/test/system/continuous/continuous-env.sh.example
@@ -25,8 +25,8 @@ ZOOKEEPER_HOME=${ZOOKEEPER_HOME:-/opt/zookeeper}
CONTINUOUS_LOG_DIR=$ACCUMULO_HOME/test/system/continuous/logs
INSTANCE_NAME=instance
ZOO_KEEPERS=zhost1,zhost2
-ACCUMULO_USER=`whoami`
-HDFS_USER=`whoami`
+ACCUMULO_USER=$(whoami)
+HDFS_USER=$(whoami)
USER=user
PASS=pass
TABLE=ci
@@ -110,7 +110,7 @@ AGITATE_HDFS=false
AGITATE_HDFS_SLEEP_TIME=10
AGITATE_HDFS_SUPERUSER=hdfs
AGITATE_HDFS_COMMAND="${HADOOP_PREFIX:-/usr/lib/hadoop}/share/hadoop/hdfs/bin/hdfs"
-AGITATE_HDFS_SUDO=`which sudo`
+AGITATE_HDFS_SUDO=$(which sudo)
#settings for the verification map reduce job
VERIFY_OUT=/tmp/continuous_verify
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/mapred-setup.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/mapred-setup.sh b/test/system/continuous/mapred-setup.sh
index e6bd2ca..4a33438 100755
--- a/test/system/continuous/mapred-setup.sh
+++ b/test/system/continuous/mapred-setup.sh
@@ -19,7 +19,7 @@
# for running a map reduce job
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-$ACCUMULO_HOME/test/system/continuous/}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
-. $ACCUMULO_CONF_DIR/accumulo-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
+. "$ACCUMULO_CONF_DIR/accumulo-env.sh"
SERVER_LIBJAR="$ACCUMULO_HOME/lib/accumulo-test.jar"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/run-moru.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/run-moru.sh b/test/system/continuous/run-moru.sh
index 3133b05..f82d5f9 100755
--- a/test/system/continuous/run-moru.sh
+++ b/test/system/continuous/run-moru.sh
@@ -18,16 +18,16 @@
# 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 )"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
-. ${bin}/mapred-setup.sh
+. "${bin}/mapred-setup.sh"
-$ACCUMULO_HOME/bin/tool.sh "$SERVER_LIBJAR" org.apache.accumulo.test.continuous.ContinuousMoru -libjars "$SERVER_LIBJAR" -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --min $MIN --max $MAX --maxColF $MAX_CF --maxColQ $MAX_CQ --batchMemory $MAX_MEM --batchLatency $MAX_LATENCY --batchThreads $NUM_THREADS --maxMappers $VERIFY_MAX_MAPS
+"$ACCUMULO_HOME/bin/tool.sh" "$SERVER_LIBJAR" org.apache.accumulo.test.continuous.ContinuousMoru -libjars "$SERVER_LIBJAR" -i "$INSTANCE_NAME" -z "$ZOO_KEEPERS" -u "$USER" -p "$PASS" --table "$TABLE" --min "$MIN" --max "$MAX" --maxColF "$MAX_CF" --maxColQ "$MAX_CQ" --batchMemory "$MAX_MEM" --batchLatency "$MAX_LATENCY" --batchThreads "$NUM_THREADS" --maxMappers "$VERIFY_MAX_MAPS"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/run-verify.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/run-verify.sh b/test/system/continuous/run-verify.sh
index 72ecc14..4706d6b 100755
--- a/test/system/continuous/run-verify.sh
+++ b/test/system/continuous/run-verify.sh
@@ -18,25 +18,21 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
-. ${bin}/mapred-setup.sh
+. "${bin}/mapred-setup.sh"
AUTH_OPT="";
+[[ -n $VERIFY_AUTHS ]] && AUTH_OPT="--auths $VERIFY_AUTHS"
-if [ -n "$VERIFY_AUTHS" ] ; then
- AUTH_OPT="--auths $VERIFY_AUTHS";
-fi
SCAN_OPT=--offline
-if [ "$SCAN_OFFLINE" == "false" ] ; then
- SCAN_OPT=
-fi
+[[ $SCAN_OFFLINE == false ]] && SCAN_OPT=
-$ACCUMULO_HOME/bin/tool.sh "$SERVER_LIBJAR" org.apache.accumulo.test.continuous.ContinuousVerify -libjars "$SERVER_LIBJAR" $AUTH_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --output $VERIFY_OUT --maxMappers $VERIFY_MAX_MAPS --reducers $VERIFY_REDUCERS $SCAN_OPT
+"$ACCUMULO_HOME/bin/tool.sh" "$SERVER_LIBJAR" org.apache.accumulo.test.continuous.ContinuousVerify -libjars "$SERVER_LIBJAR" "$AUTH_OPT" -i "$INSTANCE_NAME" -z "$ZOO_KEEPERS" -u "$USER" -p "$PASS" --table "$TABLE" --output "$VERIFY_OUT" --maxMappers "$VERIFY_MAX_MAPS" --reducers "$VERIFY_REDUCERS" "$SCAN_OPT"
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/start-agitator.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/start-agitator.sh b/test/system/continuous/start-agitator.sh
index e82e5ab..2505725 100755
--- a/test/system/continuous/start-agitator.sh
+++ b/test/system/continuous/start-agitator.sh
@@ -17,55 +17,56 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-mkdir -p $CONTINUOUS_LOG_DIR
+mkdir -p "$CONTINUOUS_LOG_DIR"
-LOG_BASE="${CONTINUOUS_LOG_DIR}/`date +%Y%m%d%H%M%S`_`hostname`"
+LOG_BASE="${CONTINUOUS_LOG_DIR}/$(date +%Y%m%d%H%M%S)_$(hostname)"
# Start agitators for datanodes, tservers, and the master
-if [[ "`whoami`" == "root" ]]; then
+[[ -n $USER ]] || USER=$(whoami)
+if [[ $USER == root ]]; then
echo "Running master-agitator and tserver-agitator as $ACCUMULO_USER using su. Running datanode-agitator as $HDFS_USER using su."
# Change to the correct user if started as root
- su -c "nohup ${bin}/master-agitator.pl $MASTER_KILL_SLEEP_TIME $MASTER_RESTART_SLEEP_TIME >${LOG_BASE}_master-agitator.out 2>${LOG_BASE}_master-agitator.err &" -m - $ACCUMULO_USER
+ su -c "nohup ${bin}/master-agitator.pl $MASTER_KILL_SLEEP_TIME $MASTER_RESTART_SLEEP_TIME >${LOG_BASE}_master-agitator.out 2>${LOG_BASE}_master-agitator.err &" -m - "$ACCUMULO_USER"
- su -c "nohup ${bin}/tserver-agitator.pl $TSERVER_KILL_SLEEP_TIME $TSERVER_RESTART_SLEEP_TIME $TSERVER_MIN_KILL $TSERVER_MAX_KILL >${LOG_BASE}_tserver-agitator.out 2>${LOG_BASE}_tserver-agitator.err &" -m - $ACCUMULO_USER
+ su -c "nohup ${bin}/tserver-agitator.pl $TSERVER_KILL_SLEEP_TIME $TSERVER_RESTART_SLEEP_TIME $TSERVER_MIN_KILL $TSERVER_MAX_KILL >${LOG_BASE}_tserver-agitator.out 2>${LOG_BASE}_tserver-agitator.err &" -m - "$ACCUMULO_USER"
- su -c "nohup ${bin}/datanode-agitator.pl $DATANODE_KILL_SLEEP_TIME $DATANODE_RESTART_SLEEP_TIME $HADOOP_PREFIX $DATANODE_MIN_KILL $DATANODE_MAX_KILL >${LOG_BASE}_datanode-agitator.out 2>${LOG_BASE}_datanode-agitator.err &" -m - $HDFS_USER
+ su -c "nohup ${bin}/datanode-agitator.pl $DATANODE_KILL_SLEEP_TIME $DATANODE_RESTART_SLEEP_TIME $HADOOP_PREFIX $DATANODE_MIN_KILL $DATANODE_MAX_KILL >${LOG_BASE}_datanode-agitator.out 2>${LOG_BASE}_datanode-agitator.err &" -m - "$HDFS_USER"
-elif [[ "`whoami`" == $ACCUMULO_USER ]]; then
- echo "Running master-agitator and tserver-agitator as `whoami`. Running datanode-agitator as $HDFS_USER using sudo."
+elif [[ $USER == "$ACCUMULO_USER" ]]; then
+ echo "Running master-agitator and tserver-agitator as $USER Running datanode-agitator as $HDFS_USER using sudo."
# Just run the master-agitator if we're the accumulo user
- nohup ${bin}/master-agitator.pl $MASTER_KILL_SLEEP_TIME $MASTER_RESTART_SLEEP_TIME >${LOG_BASE}_master-agitator.out 2>${LOG_BASE}_master-agitator.err &
+ nohup "${bin}/master-agitator.pl" "$MASTER_KILL_SLEEP_TIME" "$MASTER_RESTART_SLEEP_TIME" >"${LOG_BASE}_master-agitator.out" 2>"${LOG_BASE}_master-agitator.err" &
- nohup ${bin}/tserver-agitator.pl $TSERVER_KILL_SLEEP_TIME $TSERVER_RESTART_SLEEP_TIME $TSERVER_MIN_KILL $TSERVER_MAX_KILL >${LOG_BASE}_tserver-agitator.out 2>${LOG_BASE}_tserver-agitator.err &
+ nohup "${bin}/tserver-agitator.pl" "$TSERVER_KILL_SLEEP_TIME" "$TSERVER_RESTART_SLEEP_TIME" "$TSERVER_MIN_KILL" "$TSERVER_MAX_KILL" >"${LOG_BASE}_tserver-agitator.out" 2>"${LOG_BASE}_tserver-agitator.err" &
- sudo -u $HDFS_USER nohup ${bin}/datanode-agitator.pl $DATANODE_KILL_SLEEP_TIME $DATANODE_RESTART_SLEEP_TIME $HADOOP_PREFIX $DATANODE_MIN_KILL $DATANODE_MAX_KILL >${LOG_BASE}_datanode-agitator.out 2>${LOG_BASE}_datanode-agitator.err &
+ sudo -u "$HDFS_USER" nohup "${bin}/datanode-agitator.pl" "$DATANODE_KILL_SLEEP_TIME" "$DATANODE_RESTART_SLEEP_TIME" "$HADOOP_PREFIX" "$DATANODE_MIN_KILL" "$DATANODE_MAX_KILL" >"${LOG_BASE}_datanode-agitator.out" 2>"${LOG_BASE}_datanode-agitator.err" &
else
echo "Running master-agitator and tserver-agitator as $ACCUMULO_USER using sudo. Running datanode-agitator as $HDFS_USER using sudo."
# Not root, and not the accumulo user, hope you can sudo to it
- sudo -u $ACCUMULO_USER "nohup ${bin}/master-agitator.pl $MASTER_KILL_SLEEP_TIME $MASTER_RESTART_SLEEP_TIME >${LOG_BASE}_master-agitator.out 2>${LOG_BASE}_master-agitator.err &"
+ sudo -u "$ACCUMULO_USER" "nohup ${bin}/master-agitator.pl $MASTER_KILL_SLEEP_TIME $MASTER_RESTART_SLEEP_TIME >${LOG_BASE}_master-agitator.out 2>${LOG_BASE}_master-agitator.err &"
- sudo -u $ACCUMULO_USER "nohup ${bin}/tserver-agitator.pl $TSERVER_KILL_SLEEP_TIME $TSERVER_RESTART_SLEEP_TIME $TSERVER_MIN_KILL $TSERVER_MAX_KILL >${LOG_BASE}_tserver-agitator.out 2>${LOG_BASE}_tserver-agitator.err &"
+ sudo -u "$ACCUMULO_USER" "nohup ${bin}/tserver-agitator.pl $TSERVER_KILL_SLEEP_TIME $TSERVER_RESTART_SLEEP_TIME $TSERVER_MIN_KILL $TSERVER_MAX_KILL >${LOG_BASE}_tserver-agitator.out 2>${LOG_BASE}_tserver-agitator.err &"
- sudo -u $HDFS_USER "nohup ${bin}/datanode-agitator.pl $DATANODE_KILL_SLEEP_TIME $DATANODE_RESTART_SLEEP_TIME $HADOOP_PREFIX $DATANODE_MIN_KILL $DATANODE_MAX_KILL >${LOG_BASE}_datanode-agitator.out 2>${LOG_BASE}_datanode-agitator.err &" -m - $HDFS_USER
+ sudo -u "$HDFS_USER" "nohup ${bin}/datanode-agitator.pl $DATANODE_KILL_SLEEP_TIME $DATANODE_RESTART_SLEEP_TIME $HADOOP_PREFIX $DATANODE_MIN_KILL $DATANODE_MAX_KILL >${LOG_BASE}_datanode-agitator.out 2>${LOG_BASE}_datanode-agitator.err &" -m - "$HDFS_USER"
fi
if ${AGITATE_HDFS:-false} ; then
- AGITATOR_LOG="${LOG_BASE}_hdfs-agitator"
- sudo -u $AGITATE_HDFS_SUPERUSER nohup ${bin}/hdfs-agitator.pl --sleep ${AGITATE_HDFS_SLEEP_TIME} --hdfs-cmd ${AGITATE_HDFS_COMMAND} --superuser ${AGITATE_HDFS_SUPERUSER} >${AGITATOR_LOG}.out 2>${AGITATOR_LOG}.err &
+ AGITATOR_LOG=${LOG_BASE}_hdfs-agitator
+ sudo -u "$AGITATE_HDFS_SUPERUSER" nohup "${bin}/hdfs-agitator.pl" --sleep "${AGITATE_HDFS_SLEEP_TIME}" --hdfs-cmd "${AGITATE_HDFS_COMMAND}" --superuser "${AGITATE_HDFS_SUPERUSER}" >"${AGITATOR_LOG}.out" 2>"${AGITATOR_LOG}.err" &
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/start-batchwalkers.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/start-batchwalkers.sh b/test/system/continuous/start-batchwalkers.sh
index b3dd7be..7d4efff 100755
--- a/test/system/continuous/start-batchwalkers.sh
+++ b/test/system/continuous/start-batchwalkers.sh
@@ -18,29 +18,25 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-DEBUG_OPT="";
-AUTH_OPT="";
-
-if [ "$DEBUG_BATCH_WALKER" = "on" ] ; then
+DEBUG_OPT=''
+if [[ $DEBUG_BATCH_WALKER == on ]] ; then
DEBUG_OPT="--debug $CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_batch_walk.log";
fi
-if [ -n "$AUTHS" ] ; then
- AUTH_OPT="--auths \"$AUTHS\"";
-fi
-
+AUTH_OPT=''
+[[ -n $AUTHS ]] && AUTH_OPT="--auths \"$AUTHS\""
-pssh -h $CONTINUOUS_CONF_DIR/batch_walkers.txt "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousBatchWalker $DEBUG_OPT $AUTH_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --min $MIN --max $MAX --sleep $BATCH_WALKER_SLEEP --numToScan $BATCH_WALKER_BATCH_SIZE --scanThreads $BATCH_WALKER_THREADS >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_batch_walk.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_batch_walk.err &" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/batch_walkers.txt" "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousBatchWalker $DEBUG_OPT $AUTH_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --min $MIN --max $MAX --sleep $BATCH_WALKER_SLEEP --numToScan $BATCH_WALKER_BATCH_SIZE --scanThreads $BATCH_WALKER_THREADS >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_batch_walk.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_batch_walk.err &" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/start-ingest.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/start-ingest.sh b/test/system/continuous/start-ingest.sh
index 4684829..8cc7d07 100755
--- a/test/system/continuous/start-ingest.sh
+++ b/test/system/continuous/start-ingest.sh
@@ -18,32 +18,28 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-DEBUG_OPT="";
-VIS_OPT="";
-
-if [ "$DEBUG_INGEST" = "on" ] ; then
+DEBUG_OPT=''
+if [[ $DEBUG_INGEST == on ]] ; then
DEBUG_OPT="--debug $CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_ingest.log";
fi
-if [ -n "$VISIBILITIES" ] ; then
- VIS_OPT="--visibilities \"$VISIBILITIES\"";
-fi
-CHECKSUM_OPT=--addCheckSum
-if [ "$CHECKSUM" == "false" ] ; then
- CHECSUM_OPT=
-fi
+VIS_OPT=''
+[[ -n $VISIBILITIES ]] && VIS_OPT="--visibilities \"$VISIBILITIES\""
+
+CHECKSUM_OPT='--addCheckSum'
+[[ $CHECKSUM == false ]] && CHECKSUM_OPT=''
-pssh -h $CONTINUOUS_CONF_DIR/ingesters.txt "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousIngest $DEBUG_OPT $VIS_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --num $NUM --min $MIN --max $MAX --maxColF $MAX_CF --maxColQ $MAX_CQ --batchMemory $MAX_MEM --batchLatency $MAX_LATENCY --batchThreads $NUM_THREADS $CHECKSUM_OPT >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_ingest.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_ingest.err &" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/ingesters.txt" "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousIngest $DEBUG_OPT $VIS_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --num $NUM --min $MIN --max $MAX --maxColF $MAX_CF --maxColQ $MAX_CQ --batchMemory $MAX_MEM --batchLatency $MAX_LATENCY --batchThreads $NUM_THREADS $CHECKSUM_OPT >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_ingest.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_ingest.err &" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/start-scanners.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/start-scanners.sh b/test/system/continuous/start-scanners.sh
index 63b7fb3..c876768 100755
--- a/test/system/continuous/start-scanners.sh
+++ b/test/system/continuous/start-scanners.sh
@@ -17,29 +17,25 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
DEBUG_OPT="";
-AUTH_OPT="";
-
-if [ "$DEBUG_SCANNER" = "on" ] ; then
+if [[ "$DEBUG_SCANNER" == "on" ]] ; then
DEBUG_OPT="--debug $CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_scanner.log";
fi
-if [ -n "$AUTHS" ] ; then
- AUTH_OPT="--auths \"$AUTHS\"";
-fi
-
+AUTH_OPT="";
+[[ -n "$AUTHS" ]] && AUTH_OPT="--auths \"$AUTHS\""
-pssh -h $CONTINUOUS_CONF_DIR/scanners.txt "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousScanner $DEBUG_OPT $AUTH_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --min $MIN --max $MAX --sleep $SCANNER_SLEEP_TIME --numToScan $SCANNER_ENTRIES >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_scanner.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_scanner.err &" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/scanners.txt" "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousScanner $DEBUG_OPT $AUTH_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --min $MIN --max $MAX --sleep $SCANNER_SLEEP_TIME --numToScan $SCANNER_ENTRIES >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_scanner.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_scanner.err &" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/start-stats.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/start-stats.sh b/test/system/continuous/start-stats.sh
index a9013c4..0a90364 100755
--- a/test/system/continuous/start-stats.sh
+++ b/test/system/continuous/start-stats.sh
@@ -17,34 +17,33 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+mkdir -p "$CONTINUOUS_LOG_DIR"
-mkdir -p $CONTINUOUS_LOG_DIR
+CONFIG_OUT=$CONTINUOUS_LOG_DIR/$(date +%Y%m%d%H%M%S)_$(hostname)_config.out
-CONFIG_OUT=$CONTINUOUS_LOG_DIR/`date +%Y%m%d%H%M%S`_`hostname`_config.out
+cat "$ACCUMULO_CONF_DIR/accumulo-env.sh" > "$CONFIG_OUT"
+echo >> "$CONFIG_OUT"
+echo -e "config -np\nconfig -t $TABLE -np\nquit" | "$ACCUMULO_HOME/bin/accumulo" shell -u "$USER" -p "$PASS" >> "$CONFIG_OUT"
+echo >> "$CONFIG_OUT"
+cat "$CONTINUOUS_CONF_DIR/continuous-env.sh" >> "$CONFIG_OUT"
+echo >> "$CONFIG_OUT"
+wc -l "$CONTINUOUS_CONF_DIR/walkers.txt" >> "$CONFIG_OUT"
+wc -l "$CONTINUOUS_CONF_DIR/ingesters.txt" >> "$CONFIG_OUT"
+wc -l "$CONTINUOUS_CONF_DIR/scanners.txt" >> "$CONFIG_OUT"
+wc -l "$CONTINUOUS_CONF_DIR/batch_walkers.txt" >> "$CONFIG_OUT"
-cat $ACCUMULO_CONF_DIR/accumulo-env.sh > $CONFIG_OUT
-echo >> $CONFIG_OUT
-echo -e "config -np\nconfig -t $TABLE -np\nquit" | $ACCUMULO_HOME/bin/accumulo shell -u $USER -p $PASS >> $CONFIG_OUT
-echo >> $CONFIG_OUT
-cat $CONTINUOUS_CONF_DIR/continuous-env.sh >> $CONFIG_OUT
-echo >> $CONFIG_OUT
-echo "`wc -l $CONTINUOUS_CONF_DIR/walkers.txt`" >> $CONFIG_OUT
-echo "`wc -l $CONTINUOUS_CONF_DIR/ingesters.txt`" >> $CONFIG_OUT
-echo "`wc -l $CONTINUOUS_CONF_DIR/scanners.txt`" >> $CONFIG_OUT
-echo "`wc -l $CONTINUOUS_CONF_DIR/batch_walkers.txt`" >> $CONFIG_OUT
-
-nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousStatsCollector --table $TABLE -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS >$CONTINUOUS_LOG_DIR/`date +%Y%m%d%H%M%S`_`hostname`_stats.out 2>$CONTINUOUS_LOG_DIR/`date +%Y%m%d%H%M%S`_`hostname`_stats.err &
+nohup "$ACCUMULO_HOME/bin/accumulo" org.apache.accumulo.test.continuous.ContinuousStatsCollector --table "$TABLE" -i "$INSTANCE_NAME" -z "$ZOO_KEEPERS" -u "$USER" -p "$PASS" >"$CONTINUOUS_LOG_DIR/$(date +%Y%m%d%H%M%S)_$(hostname)_stats.out" 2>"$CONTINUOUS_LOG_DIR/$(date +%Y%m%d%H%M%S)_$(hostname)_stats.err" &
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/start-walkers.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/start-walkers.sh b/test/system/continuous/start-walkers.sh
index 32fbd51..d9bbff4 100755
--- a/test/system/continuous/start-walkers.sh
+++ b/test/system/continuous/start-walkers.sh
@@ -17,29 +17,25 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-DEBUG_OPT="";
-AUTH_OPT="";
-
-if [ "$DEBUG_WALKER" = "on" ] ; then
- DEBUG_OPT="--debug $CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_walk.log";
-fi
-
-if [ -n "$AUTHS" ] ; then
- AUTH_OPT="--auths \"$AUTHS\"";
+DEBUG_OPT=''
+if [[ "$DEBUG_WALKER" == "on" ]] ; then
+ DEBUG_OPT="--debug $CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_walk.log";
fi
+AUTH_OPT=''
+[[ -n "$AUTHS" ]] && AUTH_OPT="--auths \"$AUTHS\""
-pssh -h $CONTINUOUS_CONF_DIR/walkers.txt "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousWalk $DEBUG_OPT $AUTH_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --min $MIN --max $MAX --sleep $SLEEP_TIME >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_walk.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_walk.err &" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/walkers.txt" "mkdir -p $CONTINUOUS_LOG_DIR; nohup $ACCUMULO_HOME/bin/accumulo org.apache.accumulo.test.continuous.ContinuousWalk $DEBUG_OPT $AUTH_OPT -i $INSTANCE_NAME -z $ZOO_KEEPERS -u $USER -p $PASS --table $TABLE --min $MIN --max $MAX --sleep $SLEEP_TIME >$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_walk.out 2>$CONTINUOUS_LOG_DIR/\`date +%Y%m%d%H%M%S\`_\`hostname\`_walk.err &" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/stop-agitator.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/stop-agitator.sh b/test/system/continuous/stop-agitator.sh
index 136b451..139dde2 100755
--- a/test/system/continuous/stop-agitator.sh
+++ b/test/system/continuous/stop-agitator.sh
@@ -16,35 +16,36 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
# Try to use sudo when we wouldn't normally be able to kill the processes
-if [[ "`whoami`" == "root" ]]; then
+[[ -n $USER ]] || USER=$(whoami)
+if [[ $USER == root ]]; then
echo "Stopping all processes matching 'agitator.pl' as root"
pkill -f agitator.pl 2>/dev/null
-elif [[ "`whoami`" == $ACCUMULO_USER ]]; then
+elif [[ $USER == "$ACCUMULO_USER" ]]; then
echo "Stopping all processes matching 'datanode-agitator.pl' as $HDFS_USER"
- sudo -u $HDFS_USER pkill -f datanode-agitator.pl 2>/dev/null
+ sudo -u "$HDFS_USER" pkill -f datanode-agitator.pl 2>/dev/null
echo "Stopping all processes matching 'hdfs-agitator.pl' as $HDFS_USER"
- sudo -u $HDFS_USER pkill -f hdfs-agitator.pl 2>/dev/null
- echo "Stopping all processes matching 'agitator.pl' as `whoami`"
+ sudo -u "$HDFS_USER" pkill -f hdfs-agitator.pl 2>/dev/null
+ echo "Stopping all processes matching 'agitator.pl' as $USER"
pkill -f agitator.pl 2>/dev/null 2>/dev/null
else
echo "Stopping all processes matching 'datanode-agitator.pl' as $HDFS_USER"
- sudo -u $HDFS_USER pkill -f datanode-agitator.pl 2>/dev/null
+ sudo -u "$HDFS_USER" pkill -f datanode-agitator.pl 2>/dev/null
echo "Stopping all processes matching 'hdfs-agitator.pl' as $HDFS_USER"
- sudo -u $HDFS_USER pkill -f hdfs-agitator.pl 2>/dev/null
+ sudo -u "$HDFS_USER" pkill -f hdfs-agitator.pl 2>/dev/null
echo "Stopping all processes matching 'agitator.pl' as $ACCUMULO_USER"
- sudo -u $ACCUMULO_USER pkill -f agitator.pl 2>/dev/null
+ sudo -u "$ACCUMULO_USER" pkill -f agitator.pl 2>/dev/null
fi
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/stop-batchwalkers.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/stop-batchwalkers.sh b/test/system/continuous/stop-batchwalkers.sh
index 0250656..4696387 100755
--- a/test/system/continuous/stop-batchwalkers.sh
+++ b/test/system/continuous/stop-batchwalkers.sh
@@ -17,17 +17,17 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-pssh -h $CONTINUOUS_CONF_DIR/batch_walkers.txt "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousBatchWalker'" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/batch_walkers.txt" "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousBatchWalker'" < /dev/null
http://git-wip-us.apache.org/repos/asf/accumulo/blob/d40c887b/test/system/continuous/stop-ingest.sh
----------------------------------------------------------------------
diff --git a/test/system/continuous/stop-ingest.sh b/test/system/continuous/stop-ingest.sh
index 15f1715..d159bf7 100755
--- a/test/system/continuous/stop-ingest.sh
+++ b/test/system/continuous/stop-ingest.sh
@@ -17,17 +17,17 @@
# 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}")"
+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 )"
+bin=$( cd -P "$( dirname "${SOURCE}" )" && pwd )
script=$( basename "${SOURCE}" )
# Stop: Resolve Script Directory
CONTINUOUS_CONF_DIR=${CONTINUOUS_CONF_DIR:-${bin}}
-. $CONTINUOUS_CONF_DIR/continuous-env.sh
+. "$CONTINUOUS_CONF_DIR/continuous-env.sh"
-pssh -h $CONTINUOUS_CONF_DIR/ingesters.txt "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousIngest'" < /dev/null
+pssh -h "$CONTINUOUS_CONF_DIR/ingesters.txt" "pkill -f '[o]rg.apache.accumulo.test.continuous.ContinuousIngest'" < /dev/null