zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject svn commit: r1103798 - in /zookeeper/trunk: CHANGES.txt bin/zkServer.sh conf/zoo_sample.cfg
Date Mon, 16 May 2011 17:13:23 GMT
Author: mahadev
Date: Mon May 16 17:13:23 2011
New Revision: 1103798

URL: http://svn.apache.org/viewvc?rev=1103798&view=rev
Log:
ZOOKEEPER-1061. Zookeeper stop fails if start called twice. (Ted Dunning via mahadev)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/bin/zkServer.sh
    zookeeper/trunk/conf/zoo_sample.cfg

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1103798&r1=1103797&r2=1103798&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Mon May 16 17:13:23 2011
@@ -209,6 +209,8 @@ BUGFIXES: 
   ZOOKEEPER-1033. c client should install includes into INCDIR/zookeeper, not INCDIR/c-client-src
   (Nicholas Harteau via mahadev)
 
+  ZOOKEEPER-1061. Zookeeper stop fails if start called twice. (Ted Dunning via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-724. Improve junit test integration - log harness information 
   (phunt via mahadev)

Modified: zookeeper/trunk/bin/zkServer.sh
URL: http://svn.apache.org/viewvc/zookeeper/trunk/bin/zkServer.sh?rev=1103798&r1=1103797&r2=1103798&view=diff
==============================================================================
--- zookeeper/trunk/bin/zkServer.sh (original)
+++ zookeeper/trunk/bin/zkServer.sh Mon May 16 17:13:23 2011
@@ -95,11 +95,28 @@ _ZOO_DAEMON_OUT="$ZOO_LOG_DIR/zookeeper.
 
 case $1 in
 start)
-    echo  "Starting zookeeper ... "
+    echo  -n "Starting zookeeper ... "
+    if [ -f $ZOOPIDFILE ]; then
+      if kill -0 `cat $ZOOPIDFILE` > /dev/null 2>&1; then
+         echo $command already running as process `cat $ZOOPIDFILE`. 
+         exit 0
+      fi
+    fi
     $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
     -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" > "$_ZOO_DAEMON_OUT" 2>&1 <
/dev/null &
-    /bin/echo -n $! > "$ZOOPIDFILE"
-    echo STARTED
+    if [ $? -eq 0 ]
+    then
+      if /bin/echo -n $! > "$ZOOPIDFILE"
+      then
+        echo STARTED
+      else
+        echo FAILED TO WRITE PID
+        exit 1
+      fi
+    else
+      echo SERVER DID NOT START
+      exit 1
+    fi
     ;;
 start-foreground)
     $JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
@@ -109,15 +126,16 @@ print-cmd)
     echo "$JAVA -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\"
-cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\" > \"$_ZOO_DAEMON_OUT\" 2>&1 <
/dev/null"
     ;;
 stop)
-    echo "Stopping zookeeper ... "
+    echo -n "Stopping zookeeper ... "
     if [ ! -f "$ZOOPIDFILE" ]
     then
-    echo "error: could not find file $ZOOPIDFILE"
-    exit 1
+      echo "error: could not find file $ZOOPIDFILE"
+      exit 1
     else
-    $KILL -9 $(cat "$ZOOPIDFILE")
-    rm "$ZOOPIDFILE"
-    echo STOPPED
+      $KILL -9 $(cat "$ZOOPIDFILE")
+      rm "$ZOOPIDFILE"
+      echo STOPPED
+      exit 0
     fi
     ;;
 upgrade)
@@ -139,8 +157,10 @@ status)
     if [ "x$STAT" = "x" ]
     then
         echo "Error contacting service. It is probably not running."
+        exit 1
     else
         echo $STAT
+        exit 0
     fi
     ;;
 *)

Modified: zookeeper/trunk/conf/zoo_sample.cfg
URL: http://svn.apache.org/viewvc/zookeeper/trunk/conf/zoo_sample.cfg?rev=1103798&r1=1103797&r2=1103798&view=diff
==============================================================================
--- zookeeper/trunk/conf/zoo_sample.cfg (original)
+++ zookeeper/trunk/conf/zoo_sample.cfg Mon May 16 17:13:23 2011
@@ -7,6 +7,8 @@ initLimit=10
 # sending a request and getting an acknowledgement
 syncLimit=5
 # the directory where the snapshot is stored.
-dataDir=/export/crawlspace/mahadev/zookeeper/server1/data
+# do not use /tmp for storage, /tmp here is just 
+# example sakes.
+dataDir=/tmp/zookeeper
 # the port at which the clients will connect
 clientPort=2181



Mime
View raw message