Просмотр исходного кода

ZOOKEEPER-1119. zkServer stop command incorrectly reading comment lines in zoo.cfg (phunt via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1150937 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 14 лет назад
Родитель
Сommit
34ca9854a2
3 измененных файлов с 7 добавлено и 4 удалено
  1. 3 0
      CHANGES.txt
  2. 2 2
      bin/zkCleanup.sh
  3. 2 2
      bin/zkServer.sh

+ 3 - 0
CHANGES.txt

@@ -263,6 +263,9 @@ BUGFIXES:
   ZOOKEEPER-1134. ClientCnxnSocket string comparison using == rather than equals.
   (phunt via mahadev) 
 
+  ZOOKEEPER-1119. zkServer stop command incorrectly reading comment lines in
+  zoo.cfg (phunt via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-724. Improve junit test integration - log harness information 
   (phunt via mahadev)

+ 2 - 2
bin/zkCleanup.sh

@@ -36,8 +36,8 @@ ZOOBINDIR=`dirname "$ZOOBIN"`
 
 . "$ZOOBINDIR"/zkEnv.sh
 
-ZOODATADIR=$(grep '^dataDir=' "$ZOOCFG" | sed -e 's/.*=//')
-ZOODATALOGDIR=$(grep '^dataLogDir=' "$ZOOCFG" | sed -e 's/.*=//')
+ZOODATADIR=$(grep "^[[:space:]]*dataDir=" "$ZOOCFG" | sed -e 's/.*=//')
+ZOODATALOGDIR=$(grep "^[[:space:]]*dataLogDir=" "$ZOOCFG" | sed -e 's/.*=//')
 
 if [ "x$ZOODATALOGDIR" = "x" ]
 then

+ 2 - 2
bin/zkServer.sh

@@ -81,7 +81,7 @@ fi
 echo "Using config: $ZOOCFG" >&2
 
 if [ -z $ZOOPIDFILE ]; then
-    ZOO_DATADIR=$(grep dataDir "$ZOOCFG" | sed -e 's/.*=//')
+    ZOO_DATADIR=$(grep "^[[:space:]]*dataDir" "$ZOOCFG" | sed -e 's/.*=//')
     if [ ! -d "$ZOO_DATADIR" ]; then
         mkdir -p "$ZOO_DATADIR"
     fi
@@ -154,7 +154,7 @@ restart)
     ;;
 status)
     # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output
-    STAT=`echo stat | nc -q 1 localhost $(grep clientPort "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode`
+    STAT=`echo stat | nc -q 1 localhost $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode`
     if [ "x$STAT" = "x" ]
     then
         echo "Error contacting service. It is probably not running."