This is an automated email from the ASF dual-hosted git repository. mwalch pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/master by this push: new 6424b08 Use double brackets for bash conditionals (#865) 6424b08 is described below commit 6424b0834321fd0d2ed04d7095f86ffa7b7eac63 Author: Mike Walch <mwa...@apache.org> AuthorDate: Wed Jan 2 11:28:02 2019 -0500 Use double brackets for bash conditionals (#865) --- assemble/bin/accumulo | 8 ++++---- assemble/bin/accumulo-cluster | 4 ++-- assemble/bin/accumulo-service | 10 +++++----- assemble/bin/accumulo-util | 13 ++++++------- assemble/conf/accumulo-env.sh | 6 +++--- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/assemble/bin/accumulo b/assemble/bin/accumulo index f9e0100..77665e2 100755 --- a/assemble/bin/accumulo +++ b/assemble/bin/accumulo @@ -34,7 +34,7 @@ function main() { echo "$conf is not a valid directory. Please make sure it exists" exit 1 fi - if [ ! -f "$conf/accumulo-env.sh" ]; then + if [[ ! -f "$conf/accumulo-env.sh" ]]; then echo "accumulo-env.sh must exist in $conf" exit 1 fi @@ -51,16 +51,16 @@ function main() { mkdir -p "${ACCUMULO_LOG_DIR}" 2>/dev/null : "${MALLOC_ARENA_MAX:?"variable is not set in accumulo-env.sh"}" - if [ -x "$JAVA_HOME/bin/java" ]; then + if [[ -x "$JAVA_HOME/bin/java" ]]; then JAVA="$JAVA_HOME/bin/java" else JAVA=$(which java) fi - if [ ! -x "$JAVA" ]; then + if [[ ! -x "$JAVA" ]]; then echo "Could not find any executable java binary. Please set java on your PATH or set JAVA_HOME" exit 1 fi - if [ -n "$ACCUMULO_JAVA_PREFIX" ]; then + if [[ -n "$ACCUMULO_JAVA_PREFIX" ]]; then JAVA=($ACCUMULO_JAVA_PREFIX $JAVA) fi diff --git a/assemble/bin/accumulo-cluster b/assemble/bin/accumulo-cluster index 92da91b..dcb88df 100755 --- a/assemble/bin/accumulo-cluster +++ b/assemble/bin/accumulo-cluster @@ -128,7 +128,7 @@ function start_all() { start_service "$monitor" monitor - if [ "$1" != "--no-tservers" ]; then + if [[ "$1" != "--no-tservers" ]]; then start_tservers fi @@ -170,7 +170,7 @@ function start_here() { done for host in $local_hosts; do - if [ "$host" == "$monitor" ]; then + if [[ "$host" == "$monitor" ]]; then start_service "$host" monitor break fi diff --git a/assemble/bin/accumulo-service b/assemble/bin/accumulo-service index d44ab37..0c6f0d2 100755 --- a/assemble/bin/accumulo-service +++ b/assemble/bin/accumulo-service @@ -44,7 +44,7 @@ function invalid_args { function rotate_log () { logfile="$1" max_retained="5" - if [ -f "$logfile" ]; then + if [[ -f "$logfile" ]]; then while [[ "$max_retained" -gt 1 ]]; do prev=$(( max_retained - 1)) [ -f "$logfile.$prev" ] && mv -f "$logfile.$prev" "$logfile.$max_retained" @@ -55,7 +55,7 @@ function rotate_log () { } function start_service() { - if [ -f "$pid_file" ]; then + if [[ -f "$pid_file" ]]; then pid=$(cat "$pid_file") if kill -0 "$pid" 2>/dev/null; then echo "$host : $service already running (${pid})" @@ -87,7 +87,7 @@ function start_service() { } function stop_service() { - if [ -f "$pid_file" ]; then + if [[ -f "$pid_file" ]]; then echo "Stopping $service on $host"; kill -s TERM "$(cat "$pid_file")" 2>/dev/null rm -f "${pid_file}" 2>/dev/null @@ -95,7 +95,7 @@ function stop_service() { } function kill_service() { - if [ -f "$pid_file" ]; then + if [[ -f "$pid_file" ]]; then echo "Killing $service on $host"; kill -s KILL "$(cat "$pid_file")" 2>/dev/null rm -f "${pid_file}" 2>/dev/null @@ -120,7 +120,7 @@ function main() { export conf="${ACCUMULO_CONF_DIR:-${basedir}/conf}" export lib="${basedir}/lib" - if [ -f "${conf}/accumulo-env.sh" ]; then + if [[ -f "${conf}/accumulo-env.sh" ]]; then source "${conf}/accumulo-env.sh" fi ACCUMULO_LOG_DIR="${ACCUMULO_LOG_DIR:-${basedir}/logs}" diff --git a/assemble/bin/accumulo-util b/assemble/bin/accumulo-util index b5827da..d243cd4 100755 --- a/assemble/bin/accumulo-util +++ b/assemble/bin/accumulo-util @@ -130,12 +130,12 @@ function gen_monitor_cert() { function load_jars_hdfs() { - if [ -x "$HADOOP_HOME/bin/hadoop" ]; then + if [[ -x "$HADOOP_HOME/bin/hadoop" ]]; then HADOOP="$HADOOP_HOME/bin/hadoop" else HADOOP=$(which hadoop) fi - if [ ! -x "$HADOOP" ]; then + if [[ ! -x "$HADOOP" ]]; then echo "Could not find 'hadoop' command. Please set hadoop on your PATH or set HADOOP_HOME" exit 1 fi @@ -143,8 +143,7 @@ function load_jars_hdfs() { # Find the system context directory in HDFS SYSTEM_CONTEXT_HDFS_DIR=$(grep "general.vfs.classpaths" "$conf/accumulo.properties" | cut -d '=' -f 2) - if [ -z "$SYSTEM_CONTEXT_HDFS_DIR" ] - then + if [[ -z "$SYSTEM_CONTEXT_HDFS_DIR" ]]; then echo "Your accumulo.properties file is not set up for the HDFS Classloader. Please add the following to your accumulo.properties file where ##CLASSPATH## is one of the following formats:" echo "A single directory: hdfs://host:port/directory/" echo "A single directory with a regex: hdfs://host:port/directory/.*.jar" @@ -184,16 +183,16 @@ function load_jars_hdfs() { } function hadoop_jar() { - if [ -x "$HADOOP_HOME/bin/hadoop" ]; then + if [[ -x "$HADOOP_HOME/bin/hadoop" ]]; then HADOOP="$HADOOP_HOME/bin/hadoop" else HADOOP=$(which hadoop) fi - if [ ! -x "$HADOOP" ]; then + if [[ ! -x "$HADOOP" ]]; then echo "Could not find 'hadoop' command. Please set hadoop on your PATH or set HADOOP_HOME" exit 1 fi - if [ -z "$ZOOKEEPER_HOME" ]; then + if [[ -z "$ZOOKEEPER_HOME" ]]; then echo "ZOOKEEPER_HOME must be set!" exit 1 fi diff --git a/assemble/conf/accumulo-env.sh b/assemble/conf/accumulo-env.sh index 7801b74..1df973a 100644 --- a/assemble/conf/accumulo-env.sh +++ b/assemble/conf/accumulo-env.sh @@ -41,17 +41,17 @@ export ZOOKEEPER_HOME="${ZOOKEEPER_HOME:-/path/to/zookeeper}" ########################## ## Verify that Hadoop & Zookeeper installation directories exist -if [ ! -d "$ZOOKEEPER_HOME" ]; then +if [[ ! -d "$ZOOKEEPER_HOME" ]]; then echo "ZOOKEEPER_HOME=$ZOOKEEPER_HOME is not set to a valid directory in accumulo-env.sh" exit 1 fi -if [ ! -d "$HADOOP_HOME" ]; then +if [[ ! -d "$HADOOP_HOME" ]]; then echo "HADOOP_HOME=$HADOOP_HOME is not set to a valid directory in accumulo-env.sh" exit 1 fi ## Build using existing CLASSPATH, conf/ directory, dependencies in lib/, and external Hadoop & Zookeeper dependencies -if [ -n "$CLASSPATH" ]; then +if [[ -n "$CLASSPATH" ]]; then CLASSPATH="${CLASSPATH}:${conf}" else CLASSPATH="${conf}"