3 # init script for lui-zookeeper
5 # Licensed to the Apache Software Foundation (ASF) under one or more
6 # contributor license agreements. See the NOTICE file distributed with
7 # this work for additional information regarding copyright ownership.
8 # The ASF licenses this file to You under the Apache License, Version 2.0
9 # (the "License"); you may not use this file except in compliance with
10 # the License. You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
21 # Provides: lui-zookeeper
22 # Required-Start: $remote_fs $syslog
23 # Required-Stop: $remote_fs $syslog
24 # Default-Start: 2 3 4 5
26 # Short-Description: Apache ZooKeeper server for Index Data Local Unified Index (LUI)
31 # /etc/init.d/lui-zookeeper: start and stop the Apache ZooKeeper daemon
35 . /etc/default/masterkey-lui-zookeeper
37 . /lib/lsb/init-functions
40 # Create the PrivSep empty dir if necessary
41 if [ ! -d ${ZOOPIDDIR} ]; then
43 chown lui-solr:lui-solr ${ZOOPIDDIR}
44 chmod 0775 ${ZOOPIDDIR}
48 # Are we running from init?
50 ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
53 check_for_no_start() {
54 # forget it if we're trying to start, and /etc/masterkey/lui/zookeeper/zookeeper_not_to_be_run exists
55 if [ -e /etc/masterkey/lui/zookeeper/zookeeper_not_to_be_run ]; then
56 if [ "$1" = log_end_msg ]; then
59 if ! run_by_init; then
60 log_action_msg "Apache ZooKeeper server not in use (/etc/zookeeper/zookeeper_not_to_be_run)"
66 export PATH="${PATH:+$PATH:}/usr/sbin:/usr/bin"
72 log_daemon_msg "Starting Apache ZooKeeper server" "zookeeper"
73 if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c lui-solr -x ${ZOOKEEPER_PREFIX}/bin/zkServer.sh start; then
80 log_daemon_msg "Stopping Apache ZooKeeper server" "zookeeper"
81 if start-stop-daemon --stop --quiet --oknodo --pidfile ${ZOOPIDFILE}; then
90 log_daemon_msg "Restarting Apache ZooKeeper server" "zookeeper"
91 start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile ${ZOOPIDFILE}
92 check_for_no_start log_end_msg
93 if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c lui-solr -x ${ZOOKEEPER_PREFIX}/bin/zkServer.sh start; then
102 log_daemon_msg "Restarting Apache ZooKeeper server" "zookeeper"
104 start-stop-daemon --stop --quiet --retry 30 --pidfile ${ZOOPIDFILE}
110 check_for_no_start log_end_msg
111 if start-stop-daemon --start --quiet --oknodo --pidfile ${ZOOPIDFILE} -c lui-solr -x ${ZOOKEEPER_PREFIX}/bin/zkServer.sh start; then
119 log_progress_msg "(not running)"
124 log_progress_msg "(failed to stop)"
131 status_of_proc -p ${ZOOPIDFILE} ${JAVA_HOME}/bin/java zookeeper && exit 0 || exit $?
135 log_action_msg "Usage: /etc/init.d/lui-zookeeper {start|stop|restart|try-restart|status}"