You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2013/12/02 21:55:57 UTC

git commit: Fixes "hostname -a" errors on OS X

Updated Branches:
  refs/heads/1.5.1-SNAPSHOT 07fa748e0 -> 42e8df7eb


Fixes "hostname -a" errors on OS X


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/42e8df7e
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/42e8df7e
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/42e8df7e

Branch: refs/heads/1.5.1-SNAPSHOT
Commit: 42e8df7eb0ea5d2d803c229bb0810f9e81ded462
Parents: 07fa748
Author: Michael Allen <mi...@sqrrl.com>
Authored: Mon Dec 2 15:20:30 2013 -0500
Committer: John Vines <jv...@gmail.com>
Committed: Mon Dec 2 15:54:44 2013 -0500

----------------------------------------------------------------------
 bin/start-here.sh |  2 +-
 bin/stop-here.sh  | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/42e8df7e/bin/start-here.sh
----------------------------------------------------------------------
diff --git a/bin/start-here.sh b/bin/start-here.sh
index 29f901d..e85f367 100755
--- a/bin/start-here.sh
+++ b/bin/start-here.sh
@@ -40,7 +40,7 @@ if [ $? != 0 ]; then
    ip=$(python -c 'import socket as s; print s.gethostbyname(s.getfqdn())')
 fi
 
-HOSTS="`hostname -a` `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"

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42e8df7e/bin/stop-here.sh
----------------------------------------------------------------------
diff --git a/bin/stop-here.sh b/bin/stop-here.sh
index d539b68..4d5533a 100755
--- a/bin/stop-here.sh
+++ b/bin/stop-here.sh
@@ -33,10 +33,16 @@ bin="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
 
 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
+
 if egrep -q localhost\|127.0.0.1 $ACCUMULO_CONF_DIR/slaves; then
    $bin/accumulo admin stop localhost
 else
-   for host in "`hostname -a` `hostname`"; do
+   for host in "$(hostname -a 2> /dev/null) $(hostname)"; do
       if grep -q ${host} $ACCUMULO_CONF_DIR/slaves; then
          ${bin}/accumulo admin stop $host
       fi
@@ -47,7 +53,7 @@ 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
-         echo "Stopping ${svc} on `hostname -a | head -1` with signal ${signal}"
+         echo "Stopping ${svc} on ${HOSTNAME} with signal ${signal}"
          kill -s ${signal} ${PID}
       fi
    done