From ad2421228fa088cdafa179775effa4f03f944b03 Mon Sep 17 00:00:00 2001 From: hq Date: Fri, 2 Sep 2005 12:45:34 +0000 Subject: - New RCng stratup script with no use of tomcat55ctl. Several extra flags are provided to customize the behavior of the Tomcat process. See the header of the script for further information. - Fix permission issue with ${STDOUT_LOG} and ${STDERR_LOG} PR: 38018 [1], 38020 [2], 59571 [3], 74344 [4], 75143 [5] Submitted by: Ari Suutari [1] [2], ve [3], SimpleRezo Team [4], Anton Yudin [5] Discussed on: freebsd-java@ Reviewed by: Jan Grant Approved by: maintainer timeout --- www/tomcat55/files/tomcat.sh.in | 114 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 www/tomcat55/files/tomcat.sh.in (limited to 'www/tomcat55/files') diff --git a/www/tomcat55/files/tomcat.sh.in b/www/tomcat55/files/tomcat.sh.in new file mode 100644 index 000000000000..dcc46e56a21c --- /dev/null +++ b/www/tomcat55/files/tomcat.sh.in @@ -0,0 +1,114 @@ +#!/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` + +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 +} + +load_rc_config "${name}" +run_rc_command "$1" -- cgit