Browse Source

ZOOKEEPER-1335. Add support for --config to zkEnv.sh to specify a config directory different than what is expected (Arpit Gupta via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1422758 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 12 years ago
parent
commit
44f44b3bb8
3 changed files with 19 additions and 2 deletions
  1. 3 0
      CHANGES.txt
  2. 15 1
      bin/zkEnv.sh
  3. 1 1
      bin/zkServer.sh

+ 3 - 0
CHANGES.txt

@@ -440,6 +440,9 @@ IMPROVEMENTS:
   ZOOKEEPER-1602. a change to QuorumPeerConfig's API broke
   compatibility with HBase (Alexander Shraer via phunt)
 
+  ZOOKEEPER-1335. Add support for --config to zkEnv.sh to specify a config
+  directory different than what is expected (Arpit Gupta via mahadev)
+
 Release 3.4.0 - 
 
 Non-backward compatible changes:

+ 15 - 1
bin/zkEnv.sh

@@ -21,11 +21,25 @@
 # We use ZOOCFGDIR if defined,
 # otherwise we use /etc/zookeeper
 # or the conf directory that is
-# a sibling of this script's directory
+# a sibling of this script's directory.
+# Or you can specify the ZOOCFGDIR using the
+# '--config' option in the command line.
 
 ZOOBINDIR=${ZOOBINDIR:-/usr/bin}
 ZOOKEEPER_PREFIX=${ZOOBINDIR}/..
 
+#check to see if the conf dir is given as an optional argument
+if [ $# -gt 1 ]
+then
+    if [ "--config" = "$1" ]
+	  then
+	      shift
+	      confdir=$1
+	      shift
+	      ZOOCFGDIR=$confdir
+    fi
+fi
+
 if [ "x$ZOOCFGDIR" = "x" ]
 then
   if [ -e "${ZOOKEEPER_PREFIX}/conf" ]; then

+ 1 - 1
bin/zkServer.sh

@@ -187,6 +187,6 @@ status)
     fi
     ;;
 *)
-    echo "Usage: $0 {start|start-foreground|stop|restart|status|upgrade|print-cmd}" >&2
+    echo "Usage: $0 [--config <conf-dir>] {start|start-foreground|stop|restart|status|upgrade|print-cmd}" >&2
 
 esac