diff options
author | Michi Mutsuzaki <michim@apache.org> | 2013-01-23 02:55:58 +0000 |
---|---|---|
committer | Michi Mutsuzaki <michim@apache.org> | 2013-01-23 02:55:58 +0000 |
commit | 36b1c43ea1056084729489031bc100706ecec173 (patch) | |
tree | a10cb609c178d26f6d23f42019e780091b075c9e /bin/zkServer.sh | |
parent | 9531ec29f4806a1f127e3f02d2333a64090058e4 (diff) | |
download | zookeeper-36b1c43ea1056084729489031bc100706ecec173.tar.gz |
ZOOKEEPER-1625. zkServer.sh is looking for clientPort in config file, but it may
no longer be there with ZK-1411 (Alexander Shraer via michim)
git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1437257 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'bin/zkServer.sh')
-rwxr-xr-x | bin/zkServer.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/zkServer.sh b/bin/zkServer.sh index e744c5d2f..2f2cf6fcb 100755 --- a/bin/zkServer.sh +++ b/bin/zkServer.sh @@ -173,9 +173,23 @@ 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/.*=//'` + if ! [ $clientPort ] + then + echo "Client port not found in static config file. Looking in dynamic config file." + dataDir=`grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//'` + myid=`cat "$dataDir/myid"` + dynamicConfigFile=`grep "^[[:space:]]*dynamicConfigFile" "$ZOOCFG" | sed -e 's/.*=//'` + clientPort=`grep "^[[:space:]]*server.$myid" "$dynamicConfigFile" | sed -e 's/.*=//' | sed -e 's/.*;//' | sed -e 's/.*://'` + if ! [[ "$clientPort" =~ ^[0-9]+$ ]] ; then + echo "Client port not found. Terminating." + exit 1 + fi + 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 \ - $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//') srvr 2> /dev/null \ + $clientPort srvr 2> /dev/null \ | grep Mode` if [ "x$STAT" = "x" ] then |