blob: e9b571b26ee4f4bf9d74b52394c5efaf93b0400c [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="hive-metastore"
DESC="Hive Metastore"
EXEC_PATH="/usr/lib/hive/bin/hive"
SVC_USER="hive"
WORKING_DIR="/var/lib/hive"
DAEMON_FLAGS=""
CONF_DIR="/etc/hive/conf"
PIDFILE="/var/run/hive/${DAEMON}.pid"
generate_start() {
cat <<'__EOT__'
start() {
[ -x $EXE_FILE ] || exit $ERROR_PROGRAM_NOT_INSTALLED
log_success_msg "Starting $DESC (${DAEMON}): "
checkstatusofproc
status=$?
if [ "$status" -eq "$STATUS_RUNNING" ]; then
log_success_msg "${DESC} is running"
exit 0
fi
LOG_FILE=/var/log/hive/${DAEMON}.out
exec_env="HADOOP_OPTS=\"-Dhive.log.dir=`dirname $LOG_FILE` -Dhive.log.file=${DAEMON}.log -Dhive.log.threshold=INFO\""
# Autodetect JDBC drivers for metastore
. /usr/lib/bigtop-utils/bigtop-detect-classpath
exec_env="HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${BIGTOP_CLASSPATH} $exec_env"
su -s /bin/bash $SVC_USER -c "$exec_env nohup nice -n 0 \
$EXEC_PATH --service metastore $PORT \
> $LOG_FILE 2>&1 < /dev/null & "'echo $! '"> $PIDFILE"
sleep 3
checkstatusofproc
RETVAL=$?
[ $RETVAL -eq $STATUS_RUNNING ] && touch $LOCKFILE
return $RETVAL
}
__EOT__
}
generate_stop() {
cat <<'__EOT__'
stop() {
log_success_msg "Stopping $DESC (${DAEMON}): "
killproc -p $PIDFILE java
RETVAL=$?
[ $RETVAL -eq $RETVAL_SUCCESS ] && rm -f $LOCKFILE $PIDFILE
return $RETVAL
}
__EOT__
}