diff options
author | Ernst de Haan <znerd@FreeBSD.org> | 2002-02-04 13:39:20 +0000 |
---|---|---|
committer | Ernst de Haan <znerd@FreeBSD.org> | 2002-02-04 13:39:20 +0000 |
commit | 1fbe096f64bf2800d624e68c7e98de4e467e3f92 (patch) | |
tree | cf2a19ed3b8cda7934290185543713fbadc335fb /www/tomcat41 | |
parent | f62ea0b0a34d9d6757e367f09dcefaba8e5f2f61 (diff) | |
download | ports-1fbe096f64bf2800d624e68c7e98de4e467e3f92.tar.gz ports-1fbe096f64bf2800d624e68c7e98de4e467e3f92.zip |
Notes
Diffstat (limited to 'www/tomcat41')
-rw-r--r-- | www/tomcat41/files/daemonctl.1 | 96 | ||||
-rw-r--r-- | www/tomcat41/files/tomcatctl | 99 | ||||
-rw-r--r-- | www/tomcat41/files/tomcatctl.1 | 96 |
3 files changed, 291 insertions, 0 deletions
diff --git a/www/tomcat41/files/daemonctl.1 b/www/tomcat41/files/daemonctl.1 new file mode 100644 index 000000000000..6fb6de835686 --- /dev/null +++ b/www/tomcat41/files/daemonctl.1 @@ -0,0 +1,96 @@ +.Dd May 26, 2001 +.Dt TOMCATCTL 1 +.Os FreeBSD +.Sh NAME +.Nm tomcatctl +.Nd Tomcat server control interface +.Sh SYNOPSIS +.Nm +.Op Ar start | Ar stop +.Sh DESCRIPTION +The +.Nm +shell script provides an interface to the Tomcat application server. +.Pp +This script has 2 modes of operation, One is +.Em shell script mode +and the other is +.Em rc script mode . +If run as +.Nm +shell script mode is used, otherwise rc script mode is used. Shell script mode +assumes that the script is used as a normal shell script, while rc script mode +assumes the script is used to start or stop Tomcat at boot time. +.Pp +The script expects exactly one argument, either +.Ar start +or +.Ar stop . +If more than one argument is given, then all arguments but the first are +ignored. +.Bl -tag -width indent +.It Ar start +Start Tomcat, if it is not already running. The ID of the started process will +be saved in a PID file. +.It Ar stop +Stop Tomcat, if it is actually running. The process with the ID stored in +the PID file will be killed. +.El +.Sh ERRORS +The following error conditions are detected. They will be checked in the +specified order. In every case where an error message is printed it will be +prepended by the name of the script +.Em ( basename $0 ) . +.Pp +If no argument is passed, or if an argument other than +.Ar start +or +.Ar stop +is passed as the first argument, then a simple help message is printed and the +script is exited with error code 64. +.Pp +In +.Em rc script mode +a newline will be printed before any error message. +.Pp +When using the argument +.Ar start +the following errors conditions can be triggered: +.Bl -tag -width indent +.It Em The Tomcat PID file already exists. +Tomcat is probably already running. Prints an error message and exits the +script with error code 1. +.It Em Tomcat home directory cannot be found +Prints an error message and exits the script with error code 2. +.It Em Tomcat script cannot be found +Prints an error message and exits the script with error code 3. +.It Em Java VM cannot be found +Prints an error message and exits the script with error code 4. +.El +.Pp +When using the argument +.Ar stop +the following error condition can be triggered: +.Bl -tag -width indent +.It Em The Tomcat PID file cannot be found +Tomcat is probably not running. Prints an error message and exits the script +with error code 16. +.El +.Sh FILES +.Bl -tag -width -indent +.It Pa /var/run/jakarta-tomcat.pid +The Tomcat PID file that is used to store the process ID of the currently +running Tomcat process in. It is deleted as soon as Tomcat is stopped and +recreated when Tomcat is started. It should never be writable for anyone but +.Em root , +.It Pa %%PREFIX%%/etc/rc.d/jakarta-tomcat.sh +A symlink to the +.Nm +script. This causes Tomcat to be started at boot time. When called from this +location the +.Nm +script will use +.Em rc script mode . +.El +.Sh AUTHORS +.An Ernst de Haan Aq ernst@jollem.com diff --git a/www/tomcat41/files/tomcatctl b/www/tomcat41/files/tomcatctl new file mode 100644 index 000000000000..5ba640f927ad --- /dev/null +++ b/www/tomcat41/files/tomcatctl @@ -0,0 +1,99 @@ +#!/bin/sh + +# Set some variables +VERSION=%%PORTVERSION%% +APP_HOME=%%APP_HOME%% +USER_NAME=%%USER_NAME%% +STDOUT_LOG=%%STDOUT_LOG%% +STDERR_LOG=%%STDERR_LOG%% +JAR_FILE=${APP_HOME}/lib/webserver.jar +MYSELF=`basename $0` + +# Set the CLASSPATH +unset CLASSPATH +for i in ${APP_HOME}/lib/* ; do + if [ "$CLASSPATH" != "" ]; then + CLASSPATH=${CLASSPATH}:$i + else + CLASSPATH=$i + fi +done +if [ -f ${JAVA_HOME}/lib/tools.jar ] ; then + CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar +fi + +# Check if we're being run as a shell script or as an rc script +if [ ${MYSELF} = "%%RC_SCRIPT_NAME%%" ]; then + AS_RC_SCRIPT=yes +else + AS_RC_SCRIPT=no +fi + +# Check if the JAVA_HOME directory is defined, otherwise set it to the +# fallback default +if [ "${JAVA_HOME}a" = "a" ]; then + JAVA_HOME=%%JAVA_HOME%% +fi +JAVA_CMD=${JAVA_HOME}/bin/java + +# Function that starts the application +start() { + # Make sure the application directory does exist + if [ ! -d ${APP_HOME} ]; then + if [ "${AS_RC_SCRIPT}" = "yes" ]; then + echo "" + fi + echo "%%APP_SHORTNAME%%: ERROR: Unable to find %%APP_TITLE%% home directory at ${APP_HOME}." + exit 2 + fi + + # Make sure the application JAR file exists + if [ ! -r ${JAR_FILE} ]; then + if [ "${AS_RC_SCRIPT}" = "yes" ]; then + echo "" + fi + echo "%%APP_SHORTNAME%%: ERROR: Unable to find %%APP_TITLE%% JAR file at ${JAR_FILE}." + exit 3 + fi + + # Make sure the Java VM can be found + if [ ! -x ${JAVA_CMD} ]; then + if [ "${AS_RC_SCRIPT}" = "yes" ]; then + echo "" + fi + echo "%%APP_SHORTNAME%%: ERROR: Unable to find Java VM at ${JAVA_HOME}." + exit 4 + fi + + if [ "${AS_RC_SCRIPT}" = "yes" ]; then + echo -n " %%APP_SHORTNAME%%" + fi + su - ${USER_NAME} -c "(cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -Dtomcat.home=${APP_HOME} org.apache.tomcat.startup.Tomcat) >> ${STDOUT_LOG} 2>> ${STDERR_LOG}" +} + +# Function that stops the application +stop() { + if [ "${AS_RC_SCRIPT}" = "yes" ]; then + echo -n " %%APP_SHORTNAME%%" + fi + su - ${USER_NAME} -c "(cd ${APP_HOME} && ${JAVA_CMD} -cp ${CLASSPATH} -Dtomcat.home=${APP_HOME} org.apache.tomcat.startup.Tomcat -stop) >> ${STDOUT_LOG} 2>> ${STDERR_LOG}" +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "" + echo "Usage: ${MYSELF} { start | stop | restart }" + echo "" + exit 64 + ;; +esac diff --git a/www/tomcat41/files/tomcatctl.1 b/www/tomcat41/files/tomcatctl.1 new file mode 100644 index 000000000000..6fb6de835686 --- /dev/null +++ b/www/tomcat41/files/tomcatctl.1 @@ -0,0 +1,96 @@ +.Dd May 26, 2001 +.Dt TOMCATCTL 1 +.Os FreeBSD +.Sh NAME +.Nm tomcatctl +.Nd Tomcat server control interface +.Sh SYNOPSIS +.Nm +.Op Ar start | Ar stop +.Sh DESCRIPTION +The +.Nm +shell script provides an interface to the Tomcat application server. +.Pp +This script has 2 modes of operation, One is +.Em shell script mode +and the other is +.Em rc script mode . +If run as +.Nm +shell script mode is used, otherwise rc script mode is used. Shell script mode +assumes that the script is used as a normal shell script, while rc script mode +assumes the script is used to start or stop Tomcat at boot time. +.Pp +The script expects exactly one argument, either +.Ar start +or +.Ar stop . +If more than one argument is given, then all arguments but the first are +ignored. +.Bl -tag -width indent +.It Ar start +Start Tomcat, if it is not already running. The ID of the started process will +be saved in a PID file. +.It Ar stop +Stop Tomcat, if it is actually running. The process with the ID stored in +the PID file will be killed. +.El +.Sh ERRORS +The following error conditions are detected. They will be checked in the +specified order. In every case where an error message is printed it will be +prepended by the name of the script +.Em ( basename $0 ) . +.Pp +If no argument is passed, or if an argument other than +.Ar start +or +.Ar stop +is passed as the first argument, then a simple help message is printed and the +script is exited with error code 64. +.Pp +In +.Em rc script mode +a newline will be printed before any error message. +.Pp +When using the argument +.Ar start +the following errors conditions can be triggered: +.Bl -tag -width indent +.It Em The Tomcat PID file already exists. +Tomcat is probably already running. Prints an error message and exits the +script with error code 1. +.It Em Tomcat home directory cannot be found +Prints an error message and exits the script with error code 2. +.It Em Tomcat script cannot be found +Prints an error message and exits the script with error code 3. +.It Em Java VM cannot be found +Prints an error message and exits the script with error code 4. +.El +.Pp +When using the argument +.Ar stop +the following error condition can be triggered: +.Bl -tag -width indent +.It Em The Tomcat PID file cannot be found +Tomcat is probably not running. Prints an error message and exits the script +with error code 16. +.El +.Sh FILES +.Bl -tag -width -indent +.It Pa /var/run/jakarta-tomcat.pid +The Tomcat PID file that is used to store the process ID of the currently +running Tomcat process in. It is deleted as soon as Tomcat is stopped and +recreated when Tomcat is started. It should never be writable for anyone but +.Em root , +.It Pa %%PREFIX%%/etc/rc.d/jakarta-tomcat.sh +A symlink to the +.Nm +script. This causes Tomcat to be started at boot time. When called from this +location the +.Nm +script will use +.Em rc script mode . +.El +.Sh AUTHORS +.An Ernst de Haan Aq ernst@jollem.com |