zkEnv.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/sh
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # This script should be sourced into other zookeeper
  17. # scripts to setup the env variables
  18. # We use ZOOCFGDIR if defined,
  19. # otherwise we use /etc/zookeeper
  20. # or the conf directory that is
  21. # a sibling of this script's directory
  22. if [ "x$ZOOCFGDIR" = "x" ]
  23. then
  24. ZOOCFGDIR="$ZOOBINDIR/../conf"
  25. fi
  26. if [ "x$ZOOCFG" = "x" ]
  27. then
  28. ZOOCFG="zoo.cfg"
  29. fi
  30. ZOOCFG="$ZOOCFGDIR/$ZOOCFG"
  31. if [ -f "$ZOOCFGDIR/java.env" ]
  32. then
  33. . "$ZOOCFGDIR/java.env"
  34. fi
  35. if [ "x${ZOO_LOG_DIR}" = "x" ]
  36. then
  37. ZOO_LOG_DIR="."
  38. fi
  39. if [ "x${ZOO_LOG4J_PROP}" = "x" ]
  40. then
  41. ZOO_LOG4J_PROP="INFO,CONSOLE"
  42. fi
  43. if [ "$JAVA_HOME" != "" ]; then
  44. JAVA="$JAVA_HOME/bin/java"
  45. else
  46. JAVA=java
  47. fi
  48. #add the zoocfg dir to classpath
  49. CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
  50. for i in "$ZOOBINDIR"/../src/java/lib/*.jar
  51. do
  52. CLASSPATH="$i:$CLASSPATH"
  53. done
  54. #make it work in the release
  55. for i in "$ZOOBINDIR"/../lib/*.jar
  56. do
  57. CLASSPATH="$i:$CLASSPATH"
  58. done
  59. #make it work in the release
  60. for i in "$ZOOBINDIR"/../zookeeper-*.jar
  61. do
  62. CLASSPATH="$i:$CLASSPATH"
  63. done
  64. #make it work for developers
  65. for d in "$ZOOBINDIR"/../build/lib/*.jar
  66. do
  67. CLASSPATH="$d:$CLASSPATH"
  68. done
  69. #make it work for developers
  70. CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"
  71. case "`uname`" in
  72. CYGWIN*) cygwin=true ;;
  73. *) cygwin=false ;;
  74. esac
  75. if $cygwin
  76. then
  77. CLASSPATH=`cygpath -wp "$CLASSPATH"`
  78. fi
  79. #echo "CLASSPATH=$CLASSPATH"