Zookeeper install and config.
[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 if [ "x$ZOOCFGDIR" = "x" ]
34 then
35   if [ -e "${ZOOKEEPER_PREFIX}/conf" ]; then
36     ZOOCFGDIR="$ZOOBINDIR/../conf"
37   else
38     ZOOCFGDIR="$ZOOBINDIR/../etc/zookeeper"
39   fi
40 fi
41
42 if [ "x$ZOOCFG" = "x" ]
43 then
44     ZOOCFG="zoo.cfg"
45 fi
46
47 ZOOCFG="$ZOOCFGDIR/$ZOOCFG"
48
49 if [ -f "$ZOOCFGDIR/java.env" ]
50 then
51     . "$ZOOCFGDIR/java.env"
52 fi
53
54 if [ "x${ZOO_LOG_DIR}" = "x" ]
55 then
56     ZOO_LOG_DIR="."
57 fi
58
59 if [ "x${ZOO_LOG4J_PROP}" = "x" ]
60 then
61     ZOO_LOG4J_PROP="INFO,CONSOLE"
62 fi
63
64 if [ "$JAVA_HOME" != "" ]; then
65   JAVA="$JAVA_HOME/bin/java"
66 else
67   JAVA=java
68 fi
69
70 #add the zoocfg dir to classpath
71 CLASSPATH="$ZOOCFGDIR:$CLASSPATH"
72
73 for i in "$ZOOBINDIR"/../src/java/lib/*.jar
74 do
75     CLASSPATH="$i:$CLASSPATH"
76 done
77
78 #make it work in the binary package
79 if [ -e "${ZOOKEEPER_PREFIX}"/share/zookeeper/zookeeper-*.jar ]; then
80   for i in "$ZOOKEEPER_PREFIX"/share/zookeeper/*.jar
81   do
82     CLASSPATH="$i:$CLASSPATH"
83   done
84 else
85   #release tarball format
86   for i in "$ZOOBINDIR"/../zookeeper-*.jar
87   do
88     CLASSPATH="$i:$CLASSPATH"
89   done
90   for i in "$ZOOBINDIR"/../lib/*.jar
91   do
92     CLASSPATH="$i:$CLASSPATH"
93   done
94 fi
95
96 #make it work for developers
97 for d in "$ZOOBINDIR"/../build/lib/*.jar
98 do
99    CLASSPATH="$d:$CLASSPATH"
100 done
101
102 #make it work for developers
103 CLASSPATH="$ZOOBINDIR/../build/classes:$CLASSPATH"
104
105 case "`uname`" in
106     CYGWIN*) cygwin=true ;;
107     *) cygwin=false ;;
108 esac
109
110 if $cygwin
111 then
112     CLASSPATH=`cygpath -wp "$CLASSPATH"`
113 fi
114
115 #echo "CLASSPATH=$CLASSPATH"