Ticket #26872: zkServer.sh.patch

File zkServer.sh.patch, 2.0 KB (added by nrh@…, 14 years ago)

zkServer.sh patch to support starting in the foreground and fix readlink issue

  • bin/zkServer.sh

    old new  
    3232
    3333if [ "x$JMXDISABLE" = "x" ]
    3434then
    35     echo "JMX enabled by default"
     35    echo "JMX enabled by default" >&2
    3636    # for some reason these two options are necessary on jdk6 on Ubuntu
    3737    #   accord to the docs they are not necessary, but otw jconsole cannot
    3838    #   do a local attach
    3939    ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain"
    4040else
    41     echo "JMX disabled by user request"
     41    echo "JMX disabled by user request" >&2
    4242    ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
    4343fi
    4444
    4545# Only follow symlinks if readlink supports it
     46# macos's readlink doesn't have -f
    4647if readlink -f "$0" > /dev/null 2>&1
    4748then
    48   ZOOBIN=`readlink -f "$0"`
     49  READLINK="readlink -f"
     50else
     51  READLINK="readlink"
     52fi
     53
     54if $READLINK "$0" > /dev/null 2>&1
     55then
     56  ZOOBIN=`$READLINK "$0"`
    4957else
    5058  ZOOBIN="$0"
    5159fi
     
    5866    ZOOCFG="$ZOOCFGDIR/$2"
    5967fi
    6068
     69# if we're given a more complicated path to the config
     70# don't assume it lives in $ZOOCFGDIR, just use it
     71if [ ! -z "$2" ]
     72then
     73  if [ "`basename $2`" != "$2" ]
     74  then
     75    ZOOCFG="$2"
     76  fi
     77fi
     78
    6179if $cygwin
    6280then
    6381    ZOOCFG=`cygpath -wp "$ZOOCFG"`
     
    6785    KILL=kill
    6886fi
    6987
    70 echo "Using config: $ZOOCFG"
     88echo "Using config: $ZOOCFG" >&2
    7189
    7290ZOOPIDFILE=$(grep dataDir "$ZOOCFG" | sed -e 's/.*=//')/zookeeper_server.pid
    7391
     
    8098    /bin/echo -n $! > "$ZOOPIDFILE"
    8199    echo STARTED
    82100    ;;
     101start-foreground)
     102    java  "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
     103    -cp "$CLASSPATH" $JVMFLAGS $ZOOMAIN "$ZOOCFG"
     104    ;;
     105print-cmd)
     106    echo "java -Dzookeeper.log.dir=\"${ZOO_LOG_DIR}\" -Dzookeeper.root.logger=\"${ZOO_LOG4J_PROP}\" -cp \"$CLASSPATH\" $JVMFLAGS $ZOOMAIN \"$ZOOCFG\""
     107    ;;
    83108stop)
    84109    echo "Stopping zookeeper ... "
    85110    if [ ! -f "$ZOOPIDFILE" ]