Zookeeper configuration.
[lui-solr.git] / debian / lui-zookeeper.default
1 #!/usr/bin/env bash
2
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements.  See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License.  You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 # This script should be sourced into other zookeeper
19 # scripts to setup the env variables
20
21 # We use ZOOCFGDIR if defined,
22 # otherwise we use /etc/zookeeper
23 # or the conf directory that is
24 # a sibling of this script's directory
25
26 ZOOBINDIR=/usr/share/masterkey/lui/zookeeper/bin
27 ZOOKEEPER_PREFIX="${ZOOBINDIR}/.."
28 ZOOCFGDIR=/etc/masterkey/lui/zookeeper
29 ZOO_LOG_DIR=/var/log/masterkey/lui
30 ZOOPIDDIR=/var/lib/masterkey/lui
31 ZOOPIDFILE=${ZOOPIDDIR}/zookeeper_server.pid
32
33 JMXDISABLE=1
34 JVMFLAGS="-Xmx512m -Xms256m"
35
36 if [ "x$ZOOCFGDIR" = "x" ]
37 then
38   if [ -e "${ZOOKEEPER_PREFIX}/conf" ]; then
39     ZOOCFGDIR="$ZOOBINDIR/../conf"
40   else
41     ZOOCFGDIR="$ZOOBINDIR/../etc/zookeeper"
42   fi
43 fi
44
45 if [ "x$ZOOCFG" = "x" ]
46 then
47     ZOOCFG="zoo.cfg"
48 fi
49
50 ZOOCFG="$ZOOCFGDIR/$ZOOCFG"
51
52 if [ -f "$ZOOCFGDIR/java.env" ]
53 then
54     . "$ZOOCFGDIR/java.env"
55 fi
56
57 if [ "x${ZOO_LOG_DIR}" = "x" ]
58 then
59     ZOO_LOG_DIR="."
60 fi
61
62 if [ "x${ZOO_LOG4J_PROP}" = "x" ]
63 then
64     ZOO_LOG4J_PROP="INFO,CONSOLE"
65 fi
66
67 if [ "$JAVA_HOME" != "" ]; then
68   JAVA="$JAVA_HOME/bin/java"
69 else
70   JAVA=java
71 fi
72
73 #add the zoocfg dir to classpath
74 CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
75
76 for i in "$ZOOBINDIR"/../src/java/lib/*.jar
77 do
78     CLASSPATH="$i:$CLASSPATH"
79 done
80
81 #make it work in the binary package
82 if [ -e "${ZOOKEEPER_PREFIX}"/share/zookeeper/zookeeper-*.jar ]; then
83   for i in "$ZOOKEEPER_PREFIX"/share/zookeeper/*.jar
84   do
85     CLASSPATH="$i:$CLASSPATH"
86   done
87 else
88   #release tarball format
89   for i in "$ZOOBINDIR"/../zookeeper-*.jar
90   do
91     CLASSPATH="$i:$CLASSPATH"
92   done
93   for i in "$ZOOBINDIR"/../lib/*.jar
94   do
95     CLASSPATH="$i:$CLASSPATH"
96   done
97 fi
98
99 #make it work for developers
100 for d in "$ZOOBINDIR"/../build/lib/*.jar
101 do
102    CLASSPATH="$d:$CLASSPATH"
103 done
104
105 #make it work for developers
106 CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"
107
108 case "`uname`" in
109     CYGWIN*) cygwin=true ;;
110     *) cygwin=false ;;
111 esac
112
113 if $cygwin
114 then
115     CLASSPATH=`cygpath -wp "$CLASSPATH"`
116 fi
117
118 #echo "CLASSPATH=$CLASSPATH"