d1f2d08b33
PR: 86032 Submitted by: Julio C. Perera R. <jcperera@azul.gl>
115 lines
4.3 KiB
Bash
115 lines
4.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: jakarta-tomcat%%TOMCAT_VERSION%%
|
|
# REQUIRE: NETWORKING SERVERS
|
|
# BEFORE: DAEMON
|
|
# KEYWORD: FreeBSD shutdown
|
|
|
|
#
|
|
# Configuration settings for jakarta-tomcat%%TOMCAT_VERSION%% in /etc/rc.conf:
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_enable (bool):
|
|
# Set to "NO" by default.
|
|
# Set it to "YES" to enable jakarta-tomcat%%TOMCAT_VERSION%%
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_flags (str):
|
|
# Set to "" by default.
|
|
# Extra flags passed to start command
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home (str)
|
|
# Set to "%%TOMCAT_HOME%%" by default.
|
|
# Set the CATALINA_HOME variable for the Tomcat process
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base (str)
|
|
# Set to "%%TOMCAT_HOME%%" by default.
|
|
# Set the CATALINA_BASE variable for the Tomcat process
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir (str)
|
|
# Set to "%%TOMCAT_HOME%%/temp" by default.
|
|
# Set the CATALINA_TMPDIR variable for the Tomcat process
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log (str)
|
|
# Set to "%%STDOUT_LOG%%" by default.
|
|
# Set the location for the Tomcat process log (standard output)
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log (str)
|
|
# Set to "%%STDERR_LOG%%" by default.
|
|
# Set the location for the Tomcat process log (error output)
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_java_home (str):
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_java_vendor (str):
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_java_version (str):
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_java_os (str):
|
|
# Specify the requirements of the Java VM to use. See javavm(1).
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_classpath (str):
|
|
# Set to "" by default.
|
|
# Addtional classes to add to the CLASSPATH
|
|
#
|
|
# jakarta_tomcat%%TOMCAT_VERSION%%_java_opts (str):
|
|
# Set to "" by default.
|
|
# Java VM args to use.
|
|
#
|
|
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_enable="${jakarta_tomcat%%TOMCAT_VERSION%%_enable:-"NO"}"
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_java_version="${jakarta_tomcat%%TOMCAT_VERSION%%_java_version:-"%%JAVA_VERSION%%"}"
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_user="${jakarta_tomcat%%TOMCAT_VERSION%%_user:-"%%USER%%"}"
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home:-"%%TOMCAT_HOME%%"}"
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base:-"%%TOMCAT_HOME%%"}"
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir:-"%%TOMCAT_HOME%%/temp"}"
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log="${jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log:-"%%STDOUT_LOG%%"}"
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log="${jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log:-"%%STDERR_LOG%%"}"
|
|
|
|
. %%RC_SUBR%%
|
|
|
|
name="jakarta_tomcat%%TOMCAT_VERSION%%"
|
|
rcvar=`set_rcvar`
|
|
|
|
load_rc_config "${name}"
|
|
|
|
if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_home}" ] ; then
|
|
export JAVA_HOME="${jakarta_tomcat%%TOMCAT_VERSION%%_java_home}"
|
|
fi
|
|
|
|
if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_version}" ] ; then
|
|
export JAVA_VERSION="${jakarta_tomcat%%TOMCAT_VERSION%%_java_version}"
|
|
fi
|
|
|
|
if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_vendor}" ] ; then
|
|
export JAVA_VENDOR="${jakarta_tomcat%%TOMCAT_VERSION%%_java_vendor}"
|
|
fi
|
|
|
|
if [ -n "${jakarta_tomcat%%TOMCAT_VERSION%%_java_os}" ] ; then
|
|
export JAVA_OS="${jakarta_tomcat%%TOMCAT_VERSION%%_java_os}"
|
|
fi
|
|
|
|
java_command="%%LOCALBASE%%/bin/java \
|
|
${jakarta_tomcat%%TOMCAT_VERSION%%_java_opts} \
|
|
-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS \
|
|
-classpath %%TOMCAT_HOME%%/bin/bootstrap.jar:%%TOMCAT_HOME%%/bin/commons-logging-api.jar:${jakarta_tomcat%%TOMCAT_VERSION%%_classpath} \
|
|
-Dcatalina.base=${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_base} \
|
|
-Dcatalina.home=${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home} \
|
|
-Djava.io.tmpdir=${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_tmpdir} \
|
|
org.apache.catalina.startup.Bootstrap"
|
|
|
|
log_args=">> ${jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log} \
|
|
2>> ${jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log} "
|
|
|
|
procname="java"
|
|
required_files="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home}/conf/server.xml"
|
|
|
|
command="/usr/sbin/daemon"
|
|
flags="${command} ${java_command} start ${jakarta_tomcat%%TOMCAT_VERSION%%_flags} ${log_args}"
|
|
|
|
stop_cmd="jakarta_tomcat%%TOMCAT_VERSION%%_stop"
|
|
|
|
jakarta_tomcat%%TOMCAT_VERSION%%_stop() {
|
|
echo "Stopping ${name}."
|
|
${java_command} stop
|
|
wait_for_pids
|
|
}
|
|
|
|
run_rc_command "$1"
|