blob: ec54d0846fe41be17e53475a9632fcec2be2f427 [file] [log] [blame]
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DAEMON="hbase-@HBASE_DAEMON@"
DESC="HBase @HBASE_DAEMON@ daemon"
EXEC_PATH="/usr/lib/hbase/bin/hbase-daemon.sh"
SVC_USER="hbase"
WORKING_DIR="/var/lib/hbase"
DAEMON_FLAGS=""
CONF_DIR="/etc/hbase/conf"
PIDFILE="/var/run/hbase/hbase-${DAEMON}.pid"
generate_functions() {
cat <<'__EOT__'
hbase_env() {
export HBASE_HOME=/usr/lib/hbase
BIGTOP_DEFAULTS_DIR=${BIGTOP_DEFAULTS_DIR-/etc/default}
[ -n "${BIGTOP_DEFAULTS_DIR}" -a -r ${BIGTOP_DEFAULTS_DIR}/hbase ] && . ${BIGTOP_DEFAULTS_DIR}/hbase
}
__EOT__
}
generate_start() {
cat <<'__EOT__'
start() {
hbase_env
[ -x $EXEC_PATH ] || exit $ERROR_PROGRAM_NOT_INSTALLED
checkstatusofproc
status=$?
if [ "$status" -eq "$STATUS_RUNNING" ]; then
log_success_msg "${DESC} is running"
exit 0
fi
su -s /bin/bash hbase -c "${EXEC_PATH} start @HBASE_DAEMON@"
checkstatusofproc
RETVAL=$?
if [ $RETVAL -eq $STATUS_RUNNING ]; then
touch $LOCKFILE
log_success_msg "Started ${DESC} (${DAEMON}): "
else
log_failure_msg "Failed to start ${DESC}. Return value: $RETVAL"
fi
return $RETVAL
}
__EOT__
}
generate_stop() {
cat <<'__EOT__'
stop() {
hbase_env
su -s /bin/bash hbase -c "${EXEC_PATH} stop @HBASE_DAEMON@"
sleep 3
RETVAL=$?
if [ $RETVAL -eq $RETVAL_SUCCESS ]; then
log_success_msg "Stopped ${DESC}: "
rm -f $LOCKFILE $PIDFILE
else
log_failure_msg "Failure to stop ${DESC}. Return value: $RETVAL"
fi
return $RETVAL
}
__EOT__
}