Permalink
Fetching contributors…
Cannot retrieve contributors at this time
67 lines (54 sloc) 2.47 KB
#!/bin/bash
# Copyright 2015 Adaptavist.com Ltd.
#
# Licensed 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.
# TODO: make this run on Windows, see catalina.sh for deatils
# run whatever is in catalina.sh as Atlassian provides various versions and it can not be handled generically
# Only set CATALINA_HOME if not already set
[[ -z "${CATALINA_HOME:-}" ]] && CATALINA_HOME="${TOMCAT_DIR}"
# Copy CATALINA_BASE from CATALINA_HOME if not already set
[[ -z "${CATALINA_BASE:-}" ]] && CATALINA_BASE="$CATALINA_HOME"
if [[ -z "${LOGGING_CONFIG:-}" ]]; then
if [[ -r "$CATALINA_BASE"/conf/logging.properties ]]; then
LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
else
# Bugzilla 45585
LOGGING_CONFIG="-Dnop"
fi
fi
CLASSPATH="${CATALINA_HOME}/bin/bootstrap.jar"
if [[ -z "${LOGGING_MANAGER:-}" ]]; then
LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
# Add tomcat-juli.jar to classpath
# tomcat-juli.jar can be over-ridden per instance
if [ -r "$CATALINA_BASE/bin/tomcat-juli.jar" ] ; then
CLASSPATH="${CLASSPATH}:${CATALINA_BASE}/bin/tomcat-juli.jar"
else
CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar"
fi
fi
CATALINA_TMPDIR="${CATALINA_HOME}/temp"
TOMCAT_STOP_JAVA_OPTS="${TOMCAT_STOP_JAVA_OPTS:--Xms128m -Xmx512m -XX:MaxPermSize=256m}"
RUN_CMD="su \"${INSTANCE_USER}\" bash -c \"exec -a \"${INSTANCE_NAME}_stop\" ${JAVA_BIN} $LOGGING_CONFIG ${TOMCAT_STOP_JAVA_OPTS} ${LOGGING_MANAGER} ${CATALINA_OPTS:-} \
-Djava.endorsed.dirs=${JAVA_ENDORSED_DIRS:-''} \
-classpath $CLASSPATH \
-Dcatalina.base=$CATALINA_BASE \
-Dcatalina.home=$CATALINA_HOME \
-Djava.io.tmpdir=$CATALINA_TMPDIR \
org.apache.catalina.startup.Bootstrap stop\"";
debug "tomcat/stop/stop Running: ${RUN_CMD}"
TOMCAT_STOP_CMD=$( run_cmd "${RUN_CMD}" )
debug "${TOMCAT_STOP_CMD}"
if [[ "$(get_std_return ${TOMCAT_STOP_CMD})" != "0" ]]; then
signal_stop_process "tomcat/stop/stop"
fi