mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-14 07:43:06 +00:00
c26d95257d
PR: 239892 Submitted by: vvd@unislabs.com (maintainer)
146 lines
4.4 KiB
Bash
146 lines
4.4 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: tomcat85
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
|
|
#
|
|
# Configuration settings for tomcat85 in /etc/rc.conf:
|
|
#
|
|
# tomcat85_enable (bool):
|
|
# Set to "NO" by default.
|
|
# Set it to "YES" to enable tomcat85
|
|
#
|
|
# tomcat85_catalina_home (str)
|
|
# Set to "%%TOMCAT_HOME%%" by default.
|
|
# Set the CATALINA_HOME variable for the Tomcat process
|
|
#
|
|
# tomcat85_catalina_base (str)
|
|
# Set to "${catalina.home}" by default.
|
|
# Set the CATALINA_BASE variable for the Tomcat process
|
|
#
|
|
# tomcat85_catalina_tmpdir (str)
|
|
# Set to "${catalina.base}/temp" by default.
|
|
# Set the CATALINA_TMPDIR variable for the Tomcat process
|
|
#
|
|
# tomcat85_stdout (str)
|
|
# Set to "${catalina.base}/logs/catalina.out" by default.
|
|
# Set the stdout redirection. It may also be '/dev/null', '&1' or '&2'
|
|
#
|
|
# tomcat85_stderr (str)
|
|
# Set to "&1" by default.
|
|
# Set the stderr redirection. It may also be '/dev/null', '&1' or '&2'
|
|
#
|
|
# tomcat85_pipe_cmd (str):
|
|
# Set to "" by default.
|
|
# Set a piped command to process stdout/stderr when passthru
|
|
#
|
|
# tomcat85_logging_manager (str):
|
|
# Set to "org.apache.juli.ClassLoaderLogManager" by default.
|
|
# Set the JUL log manager
|
|
#
|
|
# tomcat85_logging_config (str):
|
|
# Set to "${catalina.base}/conf/logging.properties" by default.
|
|
# Set the JUL config file
|
|
#
|
|
# tomcat85_java_home (str):
|
|
# Set to "%%JAVA_HOME%%" by default.
|
|
# Specify the Java VM to use.
|
|
#
|
|
# tomcat85_classpath (str):
|
|
# Set to "" by default.
|
|
# Addtional classes to add to the CLASSPATH. If set, must start with ':'
|
|
#
|
|
# tomcat85_java_opts (str):
|
|
# Set to "" by default.
|
|
# Java VM args to use.
|
|
#
|
|
# tomcat85_wait (int):
|
|
# Set to "30" by default.
|
|
# Set the wait time (in seconds) for Tomcat process startup
|
|
#
|
|
# tomcat85_umask (str):
|
|
# Set to "0077" by default.
|
|
# Sets the umask for Tomcat process.
|
|
#
|
|
# You may symlink this script with other names to run multiple
|
|
# instances of tomcat85 with different configurations.
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
case $0 in
|
|
/etc/rc*)
|
|
# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown),
|
|
# so get the name of the script from $_file
|
|
name=$_file
|
|
;;
|
|
*)
|
|
name=$0
|
|
;;
|
|
esac
|
|
|
|
name=${name##*/}
|
|
rcvar=${name}_enable
|
|
|
|
load_rc_config "${name}"
|
|
|
|
eval "${rcvar}=\${${rcvar}:-'NO'}"
|
|
eval "_tomcat_java_home=\${${name}_java_home:-'%%JAVA_HOME%%'}"
|
|
eval "_tomcat_catalina_user=\${${name}_catalina_user:-'%%TOMCAT_USER%%'}"
|
|
eval "_tomcat_catalina_home=\${${name}_catalina_home:-'%%TOMCAT_HOME%%'}"
|
|
eval "_tomcat_catalina_base=\${${name}_catalina_base:-'${_tomcat_catalina_home}'}"
|
|
eval "_tomcat_catalina_tmpdir=\${${name}_catalina_tmpdir:-'${_tomcat_catalina_base}/temp'}"
|
|
eval "_tomcat_stdout=\${${name}_stdout:-'${_tomcat_catalina_base}/logs/catalina.out'}"
|
|
eval "_tomcat_stderr=\${${name}_stderr:-'&1'}"
|
|
eval "_tomcat_pipe_cmd=\${${name}_pipe_cmd:-''}"
|
|
eval "_tomcat_logging_manager=\${${name}_logging_manager:-'org.apache.juli.ClassLoaderLogManager'}"
|
|
eval "_tomcat_logging_config=\${${name}_logging_config:-'${_tomcat_catalina_base}/conf/logging.properties'}"
|
|
eval "_tomcat_classpath=\${${name}_classpath:-''}"
|
|
eval "_tomcat_java_opts=\${${name}_java_opts:-''}"
|
|
eval "_tomcat_wait=\${${name}_wait:-'30'}"
|
|
eval "_tomcat_umask=\${${name}_umask:-'0077'}"
|
|
|
|
pidfile="/var/run/${name}.pid"
|
|
|
|
required_files="${_tomcat_catalina_base}/conf/server.xml"
|
|
required_dirs="${_tomcat_catalina_tmpdir}"
|
|
|
|
extra_commands="reload"
|
|
|
|
_tomcat_java_version=`${_tomcat_java_home}/bin/java -version 2>&1 | /usr/bin/awk -F '"' '/version/ {print $2}'`
|
|
|
|
case "${_tomcat_java_version}" in
|
|
9* | 1[0-9]* )
|
|
_tomcat_endorsed_dirs_option=
|
|
;;
|
|
*)
|
|
_tomcat_endorsed_dirs_option="-Djava.endorsed.dirs='${_tomcat_catalina_home}/endorsed'"
|
|
;;
|
|
esac
|
|
|
|
command="%%LOCALBASE%%/bin/jsvc"
|
|
command_args="-java-home '${_tomcat_java_home}' \
|
|
-server \
|
|
-user ${_tomcat_catalina_user} \
|
|
-umask ${_tomcat_umask} \
|
|
-pidfile '${pidfile}' \
|
|
-wait ${_tomcat_wait} \
|
|
-outfile '${_tomcat_stdout}' \
|
|
-errfile '${_tomcat_stderr}' \
|
|
-classpath '${_tomcat_catalina_home}/bin/bootstrap.jar:%%LOCALBASE%%/share/java/classes/commons-daemon.jar:${_tomcat_catalina_home}/bin/tomcat-juli.jar${_tomcat_classpath}' \
|
|
-Djava.util.logging.manager=${_tomcat_logging_manager} \
|
|
-Djava.util.logging.config.file='${_tomcat_logging_config}' \
|
|
${_tomcat_java_opts} \
|
|
${_tomcat_endorsed_dirs_option} \
|
|
-Dcatalina.home='${_tomcat_catalina_home}' \
|
|
-Dcatalina.base='${_tomcat_catalina_base}' \
|
|
-Djava.io.tmpdir='${_tomcat_catalina_tmpdir}' \
|
|
org.apache.catalina.startup.Bootstrap \
|
|
${_tomcat_pipe_cmd}"
|
|
|
|
run_rc_command "$1"
|