ACCUMULO-4403 Use FQDN and all hostname aliases If there are multiple aliases for a host, stop-here.sh would fail to handle them. Also, fix some related shellcheck warnings in the same file.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/09c38326 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/09c38326 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/09c38326 Branch: refs/heads/master Commit: 09c38326f6f4732afad0c0779b1fc0e242bf4ce3 Parents: 7dc726e Author: Josh Elser <els...@apache.org> Authored: Sat Aug 13 23:01:15 2016 -0400 Committer: Josh Elser <els...@apache.org> Committed: Sat Aug 13 23:01:15 2016 -0400 ---------------------------------------------------------------------- assemble/bin/stop-here.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/09c38326/assemble/bin/stop-here.sh ---------------------------------------------------------------------- diff --git a/assemble/bin/stop-here.sh b/assemble/bin/stop-here.sh index 6f0aa7f..a9973f4 100755 --- a/assemble/bin/stop-here.sh +++ b/assemble/bin/stop-here.sh @@ -31,24 +31,23 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )" . "$bin"/config.sh -ACCUMULO="$ACCUMULO_HOME/lib/accumulo-start.jar" - # Determine hostname without errors to user -HOSTNAME=$(hostname -a 2> /dev/null | head -1) -[[ -z ${HOSTNAME} ]] && HOSTNAME=$(hostname) +HOSTS_TO_CHECK=($(hostname -a 2> /dev/null | head -1) $(hostname -f)) 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 + for host in "${HOSTS_TO_CHECK[@]}"; do + if grep -q "$host" "$ACCUMULO_CONF_DIR"/slaves; then "${bin}/accumulo" admin stop "$host" fi done fi -for signal in TERM KILL; do - for svc in tserver gc master monitor tracer; do - $ACCUMULO_HOME/bin/stop-server.sh $HOSTNAME "$ACCUMULO_HOME/lib/accumulo-start.jar" $svc $signal +for HOSTNAME in "${HOSTS_TO_CHECK[@]}"; do + for signal in TERM KILL; do + for svc in tserver gc master monitor tracer; do + "$ACCUMULO_HOME"/bin/stop-server.sh "$HOSTNAME" "$ACCUMULO_HOME/lib/accumulo-start.jar" $svc $signal + done done done