summaryrefslogtreecommitdiff
path: root/bin/zkServer.sh
diff options
context:
space:
mode:
authorPatrick D. Hunt <phunt@apache.org>2013-10-24 05:11:40 +0000
committerPatrick D. Hunt <phunt@apache.org>2013-10-24 05:11:40 +0000
commitbac5a6bfbb4134c7c41bb6521d1199b7ca8127a1 (patch)
tree2495ecebc42a07dee9f01da499816c5895db1a0b /bin/zkServer.sh
parent10abb60db7ca7eed540dc637ecfd638dce4edc40 (diff)
downloadzookeeper-bac5a6bfbb4134c7c41bb6521d1199b7ca8127a1.tar.gz
ZOOKEEPER-1744. clientPortAddress breaks "zkServer.sh status" (Nick Ohanian via phunt)
git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1535278 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'bin/zkServer.sh')
-rwxr-xr-xbin/zkServer.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/zkServer.sh b/bin/zkServer.sh
index 23d1e2132..74d9dc29a 100755
--- a/bin/zkServer.sh
+++ b/bin/zkServer.sh
@@ -173,7 +173,12 @@ restart)
;;
status)
# -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output
- clientPort=`grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//'`
+ clientPortAddress=`grep "^[[:space:]]*clientPortAddress[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
+ if ! [ $clientPortAddress ]
+ then
+ clientPortAddress="localhost"
+ fi
+ clientPort=`grep "^[[:space:]]*clientPort[^[:alpha:]]" "$ZOOCFG" | sed -e 's/.*=//'`
if ! [ $clientPort ]
then
echo "Client port not found in static config file. Looking in dynamic config file."
@@ -188,8 +193,8 @@ status)
fi
echo "Client port found: $clientPort"
STAT=`"$JAVA" "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
- -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain localhost \
- $clientPort srvr 2> /dev/null \
+ -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.client.FourLetterWordMain \
+ $clientPortAddress $clientPort srvr 2> /dev/null \
| grep Mode`
if [ "x$STAT" = "x" ]
then