blob: 8eb60531c7694a6f15dcd4a4ff5bbc369c4a1b0a [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="phoenix-queryserver"
DESC="Phoenix QueryServer"
EXEC_PATH="/usr/lib/phoenix/bin/queryserver.py"
SVC_USER="phoenix"
WORKING_DIR="/usr/lib/phoenix"
DAEMON_FLAGS=""
CONF_DIR=""
PIDFILE="/var/run/phoenix/${SVC_USER}-${DAEMON}.pid"
generate_start() {
cat <<'__EOT__'
start() {
[ -x $EXE_FILE ] || exit $ERROR_PROGRAM_NOT_INSTALLED
checkstatusofproc
status=$?
if [ "$status" -eq "$STATUS_RUNNING" ]; then
log_success_msg "${DESC} is running"
exit 0
fi
LOG_FILE=/var/log/phoenix/${DAEMON}.out
runuser -s /bin/bash $SVC_USER -c "nohup nice -n 0 $EXEC_PATH start \
> $LOG_FILE 2>&1 < /dev/null & "'echo $! '"> $PIDFILE"
sleep 3
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() {
runuser -s /bin/bash $SVC_USER -c "$EXEC_PATH stop"
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__
}