hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r891944 - in /hadoop/zookeeper/trunk/bin: zkCleanup.sh zkCli.sh zkEnv.sh zkServer.sh
Date Thu, 17 Dec 2009 22:09:18 GMT
Author: breed
Date: Thu Dec 17 22:09:18 2009
New Revision: 891944

URL: http://svn.apache.org/viewvc?rev=891944&view=rev
Log:
ZOOKEEPER-606. bin scripts don't work with cygwin (phunt via breed)


Modified:
    hadoop/zookeeper/trunk/bin/zkCleanup.sh
    hadoop/zookeeper/trunk/bin/zkCli.sh
    hadoop/zookeeper/trunk/bin/zkEnv.sh
    hadoop/zookeeper/trunk/bin/zkServer.sh

Modified: hadoop/zookeeper/trunk/bin/zkCleanup.sh
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/bin/zkCleanup.sh?rev=891944&r1=891943&r2=891944&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/bin/zkCleanup.sh (original)
+++ hadoop/zookeeper/trunk/bin/zkCleanup.sh Thu Dec 17 22:09:18 2009
@@ -34,18 +34,18 @@
 fi
 ZOOBINDIR=`dirname "$ZOOBIN"`
 
-. $ZOOBINDIR/zkEnv.sh
+. "$ZOOBINDIR"/zkEnv.sh
 
-ZOODATADIR=$(grep '^dataDir=' $ZOOCFG | sed -e 's/.*=//')
-ZOODATALOGDIR=$(grep '^dataLogDir=' $ZOOCFG | sed -e 's/.*=//')
+ZOODATADIR=$(grep '^dataDir=' "$ZOOCFG" | sed -e 's/.*=//')
+ZOODATALOGDIR=$(grep '^dataLogDir=' "$ZOOCFG" | sed -e 's/.*=//')
 
-if [ "x${ZOODATALOGDIR}" = "x" ]
+if [ "x$ZOODATALOGDIR" = "x" ]
 then
 echo java "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
-     -cp $CLASSPATH $JVMFLAGS \
-     org.apache.zookeeper.server.PurgeTxnLog $ZOODATADIR $*
+     -cp "$CLASSPATH" $JVMFLAGS \
+     org.apache.zookeeper.server.PurgeTxnLog "$ZOODATADIR" $*
 else
 echo java "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
-     -cp $CLASSPATH $JVMFLAGS \
-     org.apache.zookeeper.server.PurgeTxnLog $ZOODATALOGDIR $ZOODATADIR $*
+     -cp "$CLASSPATH" $JVMFLAGS \
+     org.apache.zookeeper.server.PurgeTxnLog "$ZOODATALOGDIR" "$ZOODATADIR" $*
 fi

Modified: hadoop/zookeeper/trunk/bin/zkCli.sh
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/bin/zkCli.sh?rev=891944&r1=891943&r2=891944&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/bin/zkCli.sh (original)
+++ hadoop/zookeeper/trunk/bin/zkCli.sh Thu Dec 17 22:09:18 2009
@@ -34,10 +34,8 @@
 fi
 ZOOBINDIR=`dirname "$ZOOBIN"`
 
-. $ZOOBINDIR/zkEnv.sh
-
-eval `grep -e "^dataDir=" $ZOOCFG`
+. "$ZOOBINDIR"/zkEnv.sh
 
 java "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
-     -cp $CLASSPATH $JVMFLAGS \
+     -cp "$CLASSPATH" $JVMFLAGS \
      org.apache.zookeeper.ZooKeeperMain $@

Modified: hadoop/zookeeper/trunk/bin/zkEnv.sh
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/bin/zkEnv.sh?rev=891944&r1=891943&r2=891944&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/bin/zkEnv.sh (original)
+++ hadoop/zookeeper/trunk/bin/zkEnv.sh Thu Dec 17 22:09:18 2009
@@ -44,38 +44,53 @@
     . "$ZOOCFGDIR/java.env"
 fi
 
-if [ "x$ZOO_LOG_DIR" = "x" ]
-then 
+if [ "x${ZOO_LOG_DIR}" = "x" ]
+then
     ZOO_LOG_DIR="."
 fi
 
-if [ "x$ZOO_LOG4J_PROP" = "x" ]
-then 
+if [ "x${ZOO_LOG4J_PROP}" = "x" ]
+then
     ZOO_LOG4J_PROP="INFO,CONSOLE"
 fi
 
-for f in ${ZOOBINDIR}/../zookeeper-*.jar
-do 
-    CLASSPATH="$CLASSPATH:$f"
-done
+#add the zoocfg dir to classpath
+CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
 
-ZOOLIBDIR=${ZOOLIBDIR:-$ZOOBINDIR/../lib}
-for i in "$ZOOLIBDIR"/*.jar
+for i in "$ZOOBINDIR"/../src/java/lib/*.jar
 do
-    CLASSPATH="$CLASSPATH:$i"
+    CLASSPATH="$i:$CLASSPATH"
 done
-#make it work for developers
-for d in ${ZOOBINDIR}/../build/classes
+
+#make it work in the release
+for i in "$ZOOBINDIR"/../lib/*.jar
 do
-   CLASSPATH="$CLASSPATH:$d"
+    CLASSPATH="$i:$CLASSPATH"
 done
-for d in ${ZOOBINDIR}/../build/lib/*.jar
+
+#make it work in the release
+for i in "$ZOOBINDIR"/../zookeeper-*.jar
 do
-   CLASSPATH="$CLASSPATH:$d"
+    CLASSPATH="$i:$CLASSPATH"
 done
-for d in ${ZOOBINDIR}/../src/java/lib/*.jar
+
+#make it work for developers
+for d in "$ZOOBINDIR"/../build/lib/*.jar
 do
-   CLASSPATH="$CLASSPATH:$d"
+   CLASSPATH="$d:$CLASSPATH"
 done
-#add the zoocfg dir to classpath
-CLASSPATH=$ZOOCFGDIR:$CLASSPATH
+
+#make it work for developers
+CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"
+
+case "`uname`" in
+    CYGWIN*) cygwin=true ;;
+    *) cygwin=false ;;
+esac
+
+if $cygwin
+then
+    CLASSPATH=`cygpath -wp "$CLASSPATH"`
+fi
+
+#echo "CLASSPATH=$CLASSPATH"

Modified: hadoop/zookeeper/trunk/bin/zkServer.sh
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/bin/zkServer.sh?rev=891944&r1=891943&r2=891944&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/bin/zkServer.sh (original)
+++ hadoop/zookeeper/trunk/bin/zkServer.sh Thu Dec 17 22:09:18 2009
@@ -26,7 +26,7 @@
 # http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html
 # by default we allow local JMX connections
 if [ "x$JMXLOCALONLY" = "x" ]
-then 
+then
     JMXLOCALONLY=false
 fi
 
@@ -51,34 +51,44 @@
 fi
 ZOOBINDIR=`dirname "$ZOOBIN"`
 
-. $ZOOBINDIR/zkEnv.sh
+. "$ZOOBINDIR"/zkEnv.sh
 
 if [ "x$2" != "x" ]
 then
-    ZOOCFG=$ZOOCFGDIR/$2
+    ZOOCFG="$ZOOCFGDIR/$2"
 fi
+
+if $cygwin
+then
+    ZOOCFG=`cygpath -wp "$ZOOCFG"`
+    # cygwin has a "kill" in the shell itself, gets confused
+    KILL=/bin/kill
+else
+    KILL=kill
+fi
+
 echo "Using config: $ZOOCFG"
 
-ZOOPIDFILE=$(grep dataDir $ZOOCFG | sed -e 's/.*=//')/zookeeper_server.pid
+ZOOPIDFILE=$(grep dataDir "$ZOOCFG" | sed -e 's/.*=//')/zookeeper_server.pid
 
 
 case $1 in
-start) 
+start)
     echo  "Starting zookeeper ... "
     java  "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
-    -cp $CLASSPATH $JVMFLAGS $ZOOMAIN $ZOOCFG &
-    echo $! > $ZOOPIDFILE
+    -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG" &
+    echo -n $! > "$ZOOPIDFILE"
     echo STARTED
     ;;
-stop) 
+stop)
     echo "Stopping zookeeper ... "
-    if [ ! -f $ZOOPIDFILE ]
+    if [ ! -f "$ZOOPIDFILE" ]
     then
-    echo "error: count not find file $ZOOPIDFILE"
+    echo "error: could not find file $ZOOPIDFILE"
     exit 1
-    else 
-    kill -9 $(cat $ZOOPIDFILE)
-    rm $ZOOPIDFILE
+    else
+    $KILL -9 $(cat "$ZOOPIDFILE")
+    rm "$ZOOPIDFILE"
     echo STOPPED
     fi
     ;;
@@ -86,20 +96,20 @@
     shift
     echo "upgrading the servers to 3.*"
     java "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}"
\
-    -cp $CLASSPATH $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@} 
+    -cp "$CLASSPATH" $JVMFLAGS org.apache.zookeeper.server.upgrade.UpgradeMain ${@}
     echo "Upgrading ... "
     ;;
 restart)
     shift
-    $0 stop ${@}
+    "$0" stop ${@}
     sleep 3
-    $0 start ${@}
+    "$0" start ${@}
     ;;
 status)
-    STAT=`echo stat | nc localhost $(grep clientPort $ZOOCFG | sed -e 's/.*=//') 2> /dev/null|
grep Mode`
+    STAT=`echo stat | nc localhost $(grep clientPort "$ZOOCFG" | sed -e 's/.*=//') 2>
/dev/null| grep Mode`
     if [ "x$STAT" = "x" ]
     then
-        echo "Error contacting service. It is probably not running." 
+        echo "Error contacting service. It is probably not running."
     else
         echo $STAT
     fi



Mime
View raw message