From 27ebce3cd209aa5b21eca2e0adaeb19cfc5bf6ac Mon Sep 17 00:00:00 2001 From: remm Date: Thu, 13 Jul 2006 12:46:40 +0000 Subject: [PATCH] - Add the set of scripts. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@421604 13f79535-47bb-0310-9956-ffa450edef68 --- bin/catalina-tasks.xml | 41 +++++++ bin/catalina.bat | 206 +++++++++++++++++++++++++++++++ bin/catalina.sh | 323 +++++++++++++++++++++++++++++++++++++++++++++++++ bin/cpappend.bat | 19 +++ bin/digest.bat | 41 +++++++ bin/digest.sh | 31 +++++ bin/service.bat | 112 +++++++++++++++++ bin/setclasspath.bat | 69 +++++++++++ bin/setclasspath.sh | 91 ++++++++++++++ bin/shutdown.bat | 44 +++++++ bin/shutdown.sh | 31 +++++ bin/startup.bat | 44 +++++++ bin/startup.sh | 48 ++++++++ bin/tool-wrapper.bat | 59 +++++++++ bin/tool-wrapper.sh | 78 ++++++++++++ bin/version.bat | 44 +++++++ bin/version.sh | 31 +++++ 17 files changed, 1312 insertions(+) create mode 100644 bin/catalina-tasks.xml create mode 100644 bin/catalina.bat create mode 100644 bin/catalina.sh create mode 100644 bin/cpappend.bat create mode 100644 bin/digest.bat create mode 100644 bin/digest.sh create mode 100644 bin/service.bat create mode 100644 bin/setclasspath.bat create mode 100644 bin/setclasspath.sh create mode 100644 bin/shutdown.bat create mode 100644 bin/shutdown.sh create mode 100644 bin/startup.bat create mode 100644 bin/startup.sh create mode 100644 bin/tool-wrapper.bat create mode 100644 bin/tool-wrapper.sh create mode 100644 bin/version.bat create mode 100644 bin/version.sh diff --git a/bin/catalina-tasks.xml b/bin/catalina-tasks.xml new file mode 100644 index 000000000..5d9bc2e42 --- /dev/null +++ b/bin/catalina-tasks.xml @@ -0,0 +1,41 @@ + + + + Catalina Ant Manager, JMX and JSPC Tasks + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/catalina.bat b/bin/catalina.bat new file mode 100644 index 000000000..d23a53860 --- /dev/null +++ b/bin/catalina.bat @@ -0,0 +1,206 @@ +@echo off +if "%OS%" == "Windows_NT" setlocal +rem --------------------------------------------------------------------------- +rem Start/Stop Script for the CATALINA Server +rem +rem Environment Variable Prequisites +rem +rem CATALINA_HOME May point at your Catalina "build" directory. +rem +rem CATALINA_BASE (Optional) Base directory for resolving dynamic portions +rem of a Catalina installation. If not present, resolves to +rem the same directory that CATALINA_HOME points to. +rem +rem CATALINA_OPTS (Optional) Java runtime options used when the "start", +rem "stop", or "run" command is executed. +rem +rem CATALINA_TMPDIR (Optional) Directory path location of temporary directory +rem the JVM should use (java.io.tmpdir). Defaults to +rem %CATALINA_BASE%\temp. +rem +rem JAVA_HOME Must point at your Java Development Kit installation. +rem Required to run the with the "debug" argument. +rem +rem JRE_HOME Must point at your Java Development Kit installation. +rem Defaults to JAVA_HOME if empty. +rem +rem JAVA_OPTS (Optional) Java runtime options used when the "start", +rem "stop", or "run" command is executed. +rem +rem JSSE_HOME (Optional) May point at your Java Secure Sockets Extension +rem (JSSE) installation, whose JAR files will be added to the +rem system class path used to start Tomcat. +rem +rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start" +rem command is executed. The default is "dt_shmem". +rem +rem JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start" +rem command is executed. The default is "jdbconn". +rem +rem $Id: catalina.bat 355227 2005-12-08 21:44:16Z keith $ +rem --------------------------------------------------------------------------- + +rem Guess CATALINA_HOME if not defined +set CURRENT_DIR=%cd% +if not "%CATALINA_HOME%" == "" goto gotHome +set CATALINA_HOME=%CURRENT_DIR% +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +cd .. +set CATALINA_HOME=%cd% +cd %CURRENT_DIR% +:gotHome +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +rem Get standard environment variables +if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat" + +rem Get standard Java environment variables +if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath +echo Cannot find %CATALINA_HOME%\bin\setclasspath.bat +echo This file is needed to run this program +goto end +:okSetclasspath +set BASEDIR=%CATALINA_HOME% +call "%CATALINA_HOME%\bin\setclasspath.bat" %1 +if errorlevel 1 goto end + +rem Add on extra jar files to CLASSPATH +if "%JSSE_HOME%" == "" goto noJsse +set CLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar +:noJsse +set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar + +if not "%CATALINA_BASE%" == "" goto gotBase +set CATALINA_BASE=%CATALINA_HOME% +:gotBase + +if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir +set CATALINA_TMPDIR=%CATALINA_BASE%\temp +:gotTmpdir + +if not exist "%CATALINA_HOME%\conf\logging.properties" goto noJuli +set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties" +:noJuli + +rem ----- Execute The Requested Command --------------------------------------- + +echo Using CATALINA_BASE: %CATALINA_BASE% +echo Using CATALINA_HOME: %CATALINA_HOME% +echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR% +if ""%1"" == ""debug"" goto use_jdk +echo Using JRE_HOME: %JRE_HOME% +goto java_dir_displayed +:use_jdk +echo Using JAVA_HOME: %JAVA_HOME% +:java_dir_displayed + +set _EXECJAVA=%_RUNJAVA% +set MAINCLASS=org.apache.catalina.startup.Bootstrap +set ACTION=start +set SECURITY_POLICY_FILE= +set DEBUG_OPTS= +set JPDA= + +if not ""%1"" == ""jpda"" goto noJpda +set JPDA=jpda +if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport +set JPDA_TRANSPORT=dt_shmem +:gotJpdaTransport +if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress +set JPDA_ADDRESS=jdbconn +:gotJpdaAddress +shift +:noJpda + +if ""%1"" == ""debug"" goto doDebug +if ""%1"" == ""run"" goto doRun +if ""%1"" == ""start"" goto doStart +if ""%1"" == ""stop"" goto doStop +if ""%1"" == ""version"" goto doVersion + +echo Usage: catalina ( commands ... ) +echo commands: +echo debug Start Catalina in a debugger +echo debug -security Debug Catalina with a security manager +echo jpda start Start Catalina under JPDA debugger +echo run Start Catalina in the current window +echo run -security Start in the current window with security manager +echo start Start Catalina in a separate window +echo start -security Start in a separate window with security manager +echo stop Stop Catalina +echo version What version of tomcat are you running? +goto end + +:doDebug +shift +set _EXECJAVA=%_RUNJDB% +set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\java" +if not ""%1"" == ""-security"" goto execCmd +shift +echo Using Security Manager +set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy +goto execCmd + +:doRun +shift +if not ""%1"" == ""-security"" goto execCmd +shift +echo Using Security Manager +set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy +goto execCmd + +:doStart +shift +if not "%OS%" == "Windows_NT" goto noTitle +set _EXECJAVA=start "Tomcat" %_RUNJAVA% +goto gotTitle +:noTitle +set _EXECJAVA=start %_RUNJAVA% +:gotTitle +if not ""%1"" == ""-security"" goto execCmd +shift +echo Using Security Manager +set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy +goto execCmd + +:doStop +shift +set ACTION=stop +goto execCmd + +:doVersion +%_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" org.apache.catalina.util.ServerInfo +goto end + + +:execCmd +rem Get remaining unshifted command line arguments and save them in the +set CMD_LINE_ARGS= +:setArgs +if ""%1""=="""" goto doneSetArgs +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 +shift +goto setArgs +:doneSetArgs + +rem Execute Java with the applicable properties +if not "%JPDA%" == "" goto doJpda +if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity +%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION% +goto end +:doSecurity +%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION% +goto end +:doJpda +if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda +%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION% +goto end +:doSecurityJpda +%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION% +goto end + +:end diff --git a/bin/catalina.sh b/bin/catalina.sh new file mode 100644 index 000000000..3153ad6a9 --- /dev/null +++ b/bin/catalina.sh @@ -0,0 +1,323 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Start/Stop Script for the CATALINA Server +# +# Environment Variable Prequisites +# +# CATALINA_HOME May point at your Catalina "build" directory. +# +# CATALINA_BASE (Optional) Base directory for resolving dynamic portions +# of a Catalina installation. If not present, resolves to +# the same directory that CATALINA_HOME points to. +# +# CATALINA_OPTS (Optional) Java runtime options used when the "start", +# "stop", or "run" command is executed. +# +# CATALINA_TMPDIR (Optional) Directory path location of temporary directory +# the JVM should use (java.io.tmpdir). Defaults to +# $CATALINA_BASE/temp. +# +# JAVA_HOME Must point at your Java Development Kit installation. +# Required to run the with the "debug" or "javac" argument. +# +# JRE_HOME Must point at your Java Development Kit installation. +# Defaults to JAVA_HOME if empty. +# +# JAVA_OPTS (Optional) Java runtime options used when the "start", +# "stop", or "run" command is executed. +# +# JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start" +# command is executed. The default is "dt_socket". +# +# JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start" +# command is executed. The default is 8000. +# +# JSSE_HOME (Optional) May point at your Java Secure Sockets Extension +# (JSSE) installation, whose JAR files will be added to the +# system class path used to start Tomcat. +# +# CATALINA_PID (Optional) Path of the file which should contains the pid +# of catalina startup java process, when start (fork) is used +# +# $Id: catalina.sh 394120 2006-04-14 15:25:07Z yoavs $ +# ----------------------------------------------------------------------------- + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +os400=false +darwin=false +case "`uname`" in +CYGWIN*) cygwin=true;; +OS400*) os400=true;; +Darwin*) darwin=true;; +esac + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +# Get standard environment variables +PRGDIR=`dirname "$PRG"` + +# Only set CATALINA_HOME if not already set +[ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." ; pwd` + +if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then + . "$CATALINA_HOME"/bin/setenv.sh +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"` + [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"` + [ -n "$CATALINA_BASE" ] && CATALINA_BASE=`cygpath --unix "$CATALINA_BASE"` + [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` + [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --unix "$JSSE_HOME"` +fi + +# For OS400 +if $os400; then + # Set job priority to standard for interactive (interactive - 6) by using + # the interactive priority - 6, the helper threads that respond to requests + # will be running at the same priority as interactive jobs. + COMMAND='chgjob job('$JOBNAME') runpty(6)' + system $COMMAND + + # Enable multi threading + export QIBM_MULTI_THREADED=Y +fi + +# Get standard Java environment variables +if $os400; then + # -r will Only work on the os400 if the files are: + # 1. owned by the user + # 2. owned by the PRIMARY group of the user + # this will not work if the user belongs in secondary groups + BASEDIR="$CATALINA_HOME" + . "$CATALINA_HOME"/bin/setclasspath.sh +else + if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then + BASEDIR="$CATALINA_HOME" + . "$CATALINA_HOME"/bin/setclasspath.sh + else + echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh" + echo "This file is needed to run this program" + exit 1 + fi +fi + +# Add on extra jar files to CLASSPATH +if [ -n "$JSSE_HOME" ]; then + CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar +fi +CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar + +if [ -z "$CATALINA_BASE" ] ; then + CATALINA_BASE="$CATALINA_HOME" +fi + +if [ -z "$CATALINA_TMPDIR" ] ; then + # Define the java.io.tmpdir to use for Catalina + CATALINA_TMPDIR="$CATALINA_BASE"/temp +fi + +# Bugzilla 37848: When no TTY is available, don't output to console +have_tty=0 +if [ "`tty`" != "not a tty" ]; then + have_tty=1 +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"` + JRE_HOME=`cygpath --absolute --windows "$JRE_HOME"` + CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"` + CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"` + CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"` + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --windows "$JSSE_HOME"` + JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"` +fi + +# Set juli LogManager if it is present +if [ -r "$CATALINA_HOME"/conf/logging.properties ]; then + JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties" +fi + +# ----- Execute The Requested Command ----------------------------------------- + +# Bugzilla 37848: only output this if we have a TTY +if [ $have_tty -eq 1 ]; then + echo "Using CATALINA_BASE: $CATALINA_BASE" + echo "Using CATALINA_HOME: $CATALINA_HOME" + echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR" + if [ "$1" = "debug" -o "$1" = "javac" ] ; then + echo "Using JAVA_HOME: $JAVA_HOME" + else + echo "Using JRE_HOME: $JRE_HOME" + fi +fi + +if [ "$1" = "jpda" ] ; then + if [ -z "$JPDA_TRANSPORT" ]; then + JPDA_TRANSPORT="dt_socket" + fi + if [ -z "$JPDA_ADDRESS" ]; then + JPDA_ADDRESS="8000" + fi + if [ -z "$JPDA_OPTS" ]; then + JPDA_OPTS="-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=n" + fi + CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS" + shift +fi + +if [ "$1" = "debug" ] ; then + if $os400; then + echo "Debug command not available on OS400" + exit 1 + else + shift + if [ "$1" = "-security" ] ; then + echo "Using Security Manager" + shift + exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \ + -sourcepath "$CATALINA_HOME"/../../java \ + -Djava.security.manager \ + -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap "$@" start + else + exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \ + -sourcepath "$CATALINA_HOME"/../../java \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap "$@" start + fi + fi + +elif [ "$1" = "run" ]; then + + shift + if [ "$1" = "-security" ] ; then + echo "Using Security Manager" + shift + exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \ + -Djava.security.manager \ + -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap "$@" start + else + exec "$_RUNJAVA" $JAVA_OPTS $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 "$@" start + fi + +elif [ "$1" = "start" ] ; then + + shift + touch "$CATALINA_BASE"/logs/catalina.out + if [ "$1" = "-security" ] ; then + echo "Using Security Manager" + shift + "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \ + -Djava.security.manager \ + -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \ + -Dcatalina.base="$CATALINA_BASE" \ + -Dcatalina.home="$CATALINA_HOME" \ + -Djava.io.tmpdir="$CATALINA_TMPDIR" \ + org.apache.catalina.startup.Bootstrap "$@" start \ + >> "$CATALINA_BASE"/logs/catalina.out 2>&1 & + + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi + else + "$_RUNJAVA" $JAVA_OPTS $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 "$@" start \ + >> "$CATALINA_BASE"/logs/catalina.out 2>&1 & + + if [ ! -z "$CATALINA_PID" ]; then + echo $! > $CATALINA_PID + fi + fi + +elif [ "$1" = "stop" ] ; then + + shift + FORCE=0 + if [ "$1" = "-force" ]; then + shift + FORCE=1 + fi + + "$_RUNJAVA" $JAVA_OPTS $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 + + if [ $FORCE -eq 1 ]; then + if [ ! -z "$CATALINA_PID" ]; then + echo "Killing: `cat $CATALINA_PID`" + kill -9 `cat $CATALINA_PID` + else + echo "Kill failed: \$CATALINA_PID not set" + fi + fi + +elif [ "$1" = "version" ] ; then + + "$_RUNJAVA" \ + -classpath "$CATALINA_HOME/lib/catalina.jar" \ + org.apache.catalina.util.ServerInfo + +else + + echo "Usage: catalina.sh ( commands ... )" + echo "commands:" + if $os400; then + echo " debug Start Catalina in a debugger (not available on OS400)" + echo " debug -security Debug Catalina with a security manager (not available on OS400)" + else + echo " debug Start Catalina in a debugger" + echo " debug -security Debug Catalina with a security manager" + fi + echo " jpda start Start Catalina under JPDA debugger" + echo " run Start Catalina in the current window" + echo " run -security Start in the current window with security manager" + echo " start Start Catalina in a separate window" + echo " start -security Start in a separate window with security manager" + echo " stop Stop Catalina" + echo " stop -force Stop Catalina (followed by kill -KILL)" + echo " version What version of tomcat are you running?" + exit 1 + +fi diff --git a/bin/cpappend.bat b/bin/cpappend.bat new file mode 100644 index 000000000..657e1836b --- /dev/null +++ b/bin/cpappend.bat @@ -0,0 +1,19 @@ +rem --------------------------------------------------------------------------- +rem Append to CLASSPATH +rem +rem $Id: cpappend.bat 301115 2002-08-04 18:19:43Z patrickl $ +rem --------------------------------------------------------------------------- + +rem Process the first argument +if ""%1"" == """" goto end +set CLASSPATH=%CLASSPATH%;%1 +shift + +rem Process the remaining arguments +:setArgs +if ""%1"" == """" goto doneSetArgs +set CLASSPATH=%CLASSPATH% %1 +shift +goto setArgs +:doneSetArgs +:end diff --git a/bin/digest.bat b/bin/digest.bat new file mode 100644 index 000000000..342073566 --- /dev/null +++ b/bin/digest.bat @@ -0,0 +1,41 @@ +@echo off +if "%OS%" == "Windows_NT" setlocal +rem --------------------------------------------------------------------------- +rem Script to digest password using the algorithm specified +rem +rem $Id: digest.bat 301115 2002-08-04 18:19:43Z patrickl $ +rem --------------------------------------------------------------------------- + +rem Guess CATALINA_HOME if not defined +if not "%CATALINA_HOME%" == "" goto gotHome +set CATALINA_HOME=. +if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome +set CATALINA_HOME=.. +:gotHome +if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +set EXECUTABLE=%CATALINA_HOME%\bin\tool-wrapper.bat + +rem Check that target executable exists +if exist "%EXECUTABLE%" goto okExec +echo Cannot find %EXECUTABLE% +echo This file is needed to run this program +goto end +:okExec + +rem Get remaining unshifted command line arguments and save them in the +set CMD_LINE_ARGS= +:setArgs +if ""%1""=="""" goto doneSetArgs +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 +shift +goto setArgs +:doneSetArgs + +call "%EXECUTABLE%" -server org.apache.catalina.realm.RealmBase %CMD_LINE_ARGS% + +:end diff --git a/bin/digest.sh b/bin/digest.sh new file mode 100644 index 000000000..c22a2aa4a --- /dev/null +++ b/bin/digest.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Script to digest password using the algorithm specified +# +# $Id: digest.sh 385888 2006-03-14 21:04:40Z keith $ +# ----------------------------------------------------------------------------- + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +PRGDIR=`dirname "$PRG"` +EXECUTABLE=tool-wrapper.sh + +# Check that target executable exists +if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "This file is needed to run this program" + exit 1 +fi + +exec "$PRGDIR"/"$EXECUTABLE" -server org.apache.catalina.realm.RealmBase "$@" diff --git a/bin/service.bat b/bin/service.bat new file mode 100644 index 000000000..23f698e05 --- /dev/null +++ b/bin/service.bat @@ -0,0 +1,112 @@ +@echo off +if "%OS%" == "Windows_NT" setlocal +rem --------------------------------------------------------------------------- +rem NT Service Install/Uninstall script +rem +rem Options +rem install Install the service using Tomcat5 as service name. +rem Service is installed using default settings. +rem remove Remove the service from the System. +rem +rem name (optional) If the second argument is present it is considered +rem to be new service name +rem +rem $Id: service.bat 304097 2005-09-22 13:34:05Z yoavs $ +rem --------------------------------------------------------------------------- + +rem Guess CATALINA_HOME if not defined +set CURRENT_DIR=%cd% +if not "%CATALINA_HOME%" == "" goto gotHome +set CATALINA_HOME=%cd% +if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome +rem CD to the upper dir +cd .. +set CATALINA_HOME=%cd% +:gotHome +if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome +echo The tomcat.exe was not found... +echo The CATALINA_HOME environment variable is not defined correctly. +echo This environment variable is needed to run this program +goto end +rem Make sure prerequisite environment variables are set +if not "%JAVA_HOME%" == "" goto okHome +echo The JAVA_HOME environment variable is not defined +echo This environment variable is needed to run this program +goto end +:okHome +if not "%CATALINA_BASE%" == "" goto gotBase +set CATALINA_BASE=%CATALINA_HOME% +:gotBase + +set EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe + +rem Set default Service name +set SERVICE_NAME=Tomcat6 +set PR_DISPLAYNAME=Apache Tomcat + +if "%1" == "" goto displayUsage +if "%2" == "" goto setServiceName +set SERVICE_NAME=%2 +set PR_DISPLAYNAME=Apache Tomcat %2 +:setServiceName +if %1 == install goto doInstall +if %1 == remove goto doRemove +if %1 == uninstall goto doRemove +echo Unknown parameter "%1" +:displayUsage +echo. +echo Usage: service.bat install/remove [service_name] +goto end + +:doRemove +rem Remove the service +"%EXECUTABLE%" //DS//%SERVICE_NAME% +echo The service '%SERVICE_NAME%' has been removed +goto end + +:doInstall +rem Install the service +echo Installing the service '%SERVICE_NAME%' ... +echo Using CATALINA_HOME: %CATALINA_HOME% +echo Using CATALINA_BASE: %CATALINA_BASE% +echo Using JAVA_HOME: %JAVA_HOME% + +rem Use the environment variables as an example +rem Each command line option is prefixed with PR_ + +set PR_DESCRIPTION=Apache Tomcat Server - http://jakarta.apache.org/tomcat +set PR_INSTALL=%EXECUTABLE% +set PR_LOGPATH=%CATALINA_BASE%\logs +set PR_CLASSPATH=%CATALINA_HOME%\bin\bootstrap.jar +rem Set the server jvm from JAVA_HOME +set PR_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll +if exist "%PR_JVM%" goto foundJvm +rem Set the client jvm from JAVA_HOME +set PR_JVM=%JAVA_HOME%\jre\bin\client\jvm.dll +if exist "%PR_JVM%" goto foundJvm +set PR_JVM=auto +:foundJvm +echo Using JVM: %PR_JVM% +"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop +if not errorlevel 1 goto installed +echo Failed installing '%SERVICE_NAME%' service +goto end +:installed +rem Clear the environment variables. They are not needed any more. +set PR_DISPLAYNAME= +set PR_DESCRIPTION= +set PR_INSTALL= +set PR_LOGPATH= +set PR_CLASSPATH= +set PR_JVM= +rem Set extra parameters +"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm +rem More extra parameters +set PR_LOGPATH=%CATALINA_BASE%\logs +set PR_STDOUTPUT=auto +set PR_STDERROR=auto +"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp" --JvmMs 128 --JvmMx 256 +echo The service '%SERVICE_NAME%' has been installed. + +:end +cd %CURRENT_DIR% diff --git a/bin/setclasspath.bat b/bin/setclasspath.bat new file mode 100644 index 000000000..7cd169004 --- /dev/null +++ b/bin/setclasspath.bat @@ -0,0 +1,69 @@ +rem --------------------------------------------------------------------------- +rem Set CLASSPATH and Java options +rem +rem $Id: setclasspath.bat 355227 2005-12-08 21:44:16Z keith $ +rem --------------------------------------------------------------------------- + +rem Make sure prerequisite environment variables are set +if not "%JAVA_HOME%" == "" goto gotJdkHome +if not "%JRE_HOME%" == "" goto gotJreHome +echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined +echo At least one of these environment variable is needed to run this program +goto exit + +:gotJreHome +if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome +if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome +if not ""%1"" == ""debug"" goto okJavaHome +echo JAVA_HOME should point to a JDK in order to run in debug mode. +goto exit + +:gotJdkHome +if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome +if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome +if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome +if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome +if not "%JRE_HOME%" == "" goto okJavaHome +set JRE_HOME=%JAVA_HOME% +goto okJavaHome + +:noJavaHome +echo The JAVA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +echo NB: JAVA_HOME should point to a JDK not a JRE +goto exit +:okJavaHome + +if not "%BASEDIR%" == "" goto gotBasedir +echo The BASEDIR environment variable is not defined +echo This environment variable is needed to run this program +goto exit +:gotBasedir +if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir +echo The BASEDIR environment variable is not defined correctly +echo This environment variable is needed to run this program +goto exit +:okBasedir + +rem Set the default -Djava.endorsed.dirs argument +set JAVA_ENDORSED_DIRS=%BASEDIR%\common\endorsed + +rem Set standard CLASSPATH +rem Note that there are no quotes as we do not want to introduce random +rem quotes into the CLASSPATH +set CLASSPATH=%JAVA_HOME%\lib\tools.jar + +rem Set standard command for invoking Java. +rem Note that NT requires a window name argument when using start. +rem Also note the quoting as JAVA_HOME may contain spaces. +set _RUNJAVA="%JRE_HOME%\bin\java" +set _RUNJAVAW="%JRE_HOME%\bin\javaw" +set _RUNJDB="%JAVA_HOME%\bin\jdb" +set _RUNJAVAC="%JAVA_HOME%\bin\javac" + +goto end + +:exit +exit /b 1 + +:end diff --git a/bin/setclasspath.sh b/bin/setclasspath.sh new file mode 100644 index 000000000..73311a65a --- /dev/null +++ b/bin/setclasspath.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Set CLASSPATH and Java options +# +# $Id: setclasspath.sh 345508 2005-11-18 15:54:56Z yoavs $ +# ----------------------------------------------------------------------------- + +# First clear out the user classpath +CLASSPATH= + +# Make sure prerequisite environment variables are set +if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then + # Bugzilla 37284 + if $darwin && [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home" ]; then + export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home" + else + echo "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined" + echo "At least one of these environment variable is needed to run this program" + exit 1 + fi +fi +if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then + echo "JAVA_HOME should point to a JDK in order to run in debug mode." + exit 1 +fi +if [ -z "$JRE_HOME" ]; then + JRE_HOME="$JAVA_HOME" +fi + +# If we're running under jdb, we need a full jdk. +if [ "$1" = "debug" -o "$1" = "javac" ] ; then + if [ "$os400" = "true" ]; then + if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then + echo "The JAVA_HOME environment variable is not defined correctly" + echo "This environment variable is needed to run this program" + echo "NB: JAVA_HOME should point to a JDK not a JRE" + exit 1 + fi + else + if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then + echo "The JAVA_HOME environment variable is not defined correctly" + echo "This environment variable is needed to run this program" + echo "NB: JAVA_HOME should point to a JDK not a JRE" + exit 1 + fi + fi +fi +if [ -z "$BASEDIR" ]; then + echo "The BASEDIR environment variable is not defined" + echo "This environment variable is needed to run this program" + exit 1 +fi +if [ ! -x "$BASEDIR"/bin/setclasspath.sh ]; then + if $os400; then + # -x will Only work on the os400 if the files are: + # 1. owned by the user + # 2. owned by the PRIMARY group of the user + # this will not work if the user belongs in secondary groups + eval + else + echo "The BASEDIR environment variable is not defined correctly" + echo "This environment variable is needed to run this program" + exit 1 + fi +fi + +# Set the default -Djava.endorsed.dirs argument +JAVA_ENDORSED_DIRS="$BASEDIR"/common/endorsed + +# Set standard CLASSPATH +if [ "$1" = "debug" -o "$1" = "javac" ] ; then + CLASSPATH="$JAVA_HOME"/lib/tools.jar +fi + +# OSX hack to CLASSPATH +JIKESPATH= +if [ `uname -s` = "Darwin" ]; then + OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes" + if [ -d "$OSXHACK" ]; then + for i in "$OSXHACK"/*.jar; do + JIKESPATH="$JIKESPATH":"$i" + done + fi +fi + +# Set standard commands for invoking Java. + _RUNJAVA="$JRE_HOME"/bin/java +if [ "$os400" != "true" ]; then + _RUNJDB="$JAVA_HOME"/bin/jdb +fi +_RUNJAVAC="$JAVA_HOME"/bin/javac diff --git a/bin/shutdown.bat b/bin/shutdown.bat new file mode 100644 index 000000000..a5ad4d7f6 --- /dev/null +++ b/bin/shutdown.bat @@ -0,0 +1,44 @@ +@echo off +if "%OS%" == "Windows_NT" setlocal +rem --------------------------------------------------------------------------- +rem Stop script for the CATALINA Server +rem +rem $Id: shutdown.bat 302913 2004-05-27 15:05:01Z yoavs $ +rem --------------------------------------------------------------------------- + +rem Guess CATALINA_HOME if not defined +set CURRENT_DIR=%cd% +if not "%CATALINA_HOME%" == "" goto gotHome +set CATALINA_HOME=%CURRENT_DIR% +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +cd .. +set CATALINA_HOME=%cd% +cd %CURRENT_DIR% +:gotHome +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat + +rem Check that target executable exists +if exist "%EXECUTABLE%" goto okExec +echo Cannot find %EXECUTABLE% +echo This file is needed to run this program +goto end +:okExec + +rem Get remaining unshifted command line arguments and save them in the +set CMD_LINE_ARGS= +:setArgs +if ""%1""=="""" goto doneSetArgs +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 +shift +goto setArgs +:doneSetArgs + +call "%EXECUTABLE%" stop %CMD_LINE_ARGS% + +:end diff --git a/bin/shutdown.sh b/bin/shutdown.sh new file mode 100644 index 000000000..f95ad9dd6 --- /dev/null +++ b/bin/shutdown.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Stop script for the CATALINA Server +# +# $Id: shutdown.sh 385888 2006-03-14 21:04:40Z keith $ +# ----------------------------------------------------------------------------- + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +PRGDIR=`dirname "$PRG"` +EXECUTABLE=catalina.sh + +# Check that target executable exists +if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "This file is needed to run this program" + exit 1 +fi + +exec "$PRGDIR"/"$EXECUTABLE" stop "$@" diff --git a/bin/startup.bat b/bin/startup.bat new file mode 100644 index 000000000..6af547bd6 --- /dev/null +++ b/bin/startup.bat @@ -0,0 +1,44 @@ +@echo off +if "%OS%" == "Windows_NT" setlocal +rem --------------------------------------------------------------------------- +rem Start script for the CATALINA Server +rem +rem $Id: startup.bat 302918 2004-05-27 18:25:11Z yoavs $ +rem --------------------------------------------------------------------------- + +rem Guess CATALINA_HOME if not defined +set CURRENT_DIR=%cd% +if not "%CATALINA_HOME%" == "" goto gotHome +set CATALINA_HOME=%CURRENT_DIR% +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +cd .. +set CATALINA_HOME=%cd% +cd %CURRENT_DIR% +:gotHome +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat + +rem Check that target executable exists +if exist "%EXECUTABLE%" goto okExec +echo Cannot find %EXECUTABLE% +echo This file is needed to run this program +goto end +:okExec + +rem Get remaining unshifted command line arguments and save them in the +set CMD_LINE_ARGS= +:setArgs +if ""%1""=="""" goto doneSetArgs +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 +shift +goto setArgs +:doneSetArgs + +call "%EXECUTABLE%" start %CMD_LINE_ARGS% + +:end diff --git a/bin/startup.sh b/bin/startup.sh new file mode 100644 index 000000000..d23bae614 --- /dev/null +++ b/bin/startup.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Start Script for the CATALINA Server +# +# $Id: startup.sh 385888 2006-03-14 21:04:40Z keith $ +# ----------------------------------------------------------------------------- + +# Better OS/400 detection: see Bugzilla 31132 +os400=false +darwin=false +case "`uname`" in +CYGWIN*) cygwin=true;; +OS400*) os400=true;; +Darwin*) darwin=true;; +esac + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +PRGDIR=`dirname "$PRG"` +EXECUTABLE=catalina.sh + +# Check that target executable exists +if $os400; then + # -x will Only work on the os400 if the files are: + # 1. owned by the user + # 2. owned by the PRIMARY group of the user + # this will not work if the user belongs in secondary groups + eval +else + if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "This file is needed to run this program" + exit 1 + fi +fi + +exec "$PRGDIR"/"$EXECUTABLE" start "$@" diff --git a/bin/tool-wrapper.bat b/bin/tool-wrapper.bat new file mode 100644 index 000000000..17aa5c946 --- /dev/null +++ b/bin/tool-wrapper.bat @@ -0,0 +1,59 @@ +@echo off +if "%OS%" == "Windows_NT" setlocal +rem --------------------------------------------------------------------------- +rem Wrapper script for command line tools +rem +rem Environment Variable Prequisites +rem +rem CATALINA_HOME May point at your Catalina "build" directory. +rem +rem TOOL_OPTS (Optional) Java runtime options used when the "start", +rem "stop", or "run" command is executed. +rem +rem JAVA_HOME Must point at your Java Development Kit installation. +rem +rem JAVA_OPTS (Optional) Java runtime options used when the "start", +rem "stop", or "run" command is executed. +rem +rem $Id: tool-wrapper.bat 303419 2004-10-25 18:08:08Z markt $ +rem --------------------------------------------------------------------------- + +rem Guess CATALINA_HOME if not defined +if not "%CATALINA_HOME%" == "" goto gotHome +set CATALINA_HOME=. +if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome +set CATALINA_HOME=.. +:gotHome +if exist "%CATALINA_HOME%\bin\tool-wrapper.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +rem Get standard environment variables +if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat" + +rem Get standard Java environment variables +if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath +echo Cannot find %CATALINA_HOME%\bin\setclasspath.bat +echo This file is needed to run this program +goto end +:okSetclasspath +set BASEDIR=%CATALINA_HOME% +call "%CATALINA_HOME%\bin\setclasspath.bat" + +rem Add on extra jar files to CLASSPATH +set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar;"%BASEDIR%"\lib\servlet-api.jar + +rem Get remaining unshifted command line arguments and save them in the +set CMD_LINE_ARGS= +:setArgs +if ""%1""=="""" goto doneSetArgs +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 +shift +goto setArgs +:doneSetArgs + +%_RUNJAVA% %JAVA_OPTS% %TOOL_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.home="%CATALINA_HOME%" org.apache.catalina.startup.Tool %CMD_LINE_ARGS% + +:end diff --git a/bin/tool-wrapper.sh b/bin/tool-wrapper.sh new file mode 100644 index 000000000..473f2a8f9 --- /dev/null +++ b/bin/tool-wrapper.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Wrapper script for command line tools +# +# Environment Variable Prequisites +# +# CATALINA_HOME May point at your Catalina "build" directory. +# +# TOOL_OPTS (Optional) Java runtime options used when the "start", +# "stop", or "run" command is executed. +# +# JAVA_HOME Must point at your Java Development Kit installation. +# +# JAVA_OPTS (Optional) Java runtime options used when the "start", +# "stop", or "run" command is executed. +# +# $Id: tool-wrapper.sh 385888 2006-03-14 21:04:40Z keith $ +# ----------------------------------------------------------------------------- + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false +case "`uname`" in +CYGWIN*) cygwin=true;; +esac + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +# Get standard environment variables +PRGDIR=`dirname "$PRG"` +CATALINA_HOME=`cd "$PRGDIR/.." ; pwd` +if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then + . "$CATALINA_HOME"/bin/setenv.sh +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"` + [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# Get standard Java environment variables +if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then + BASEDIR="$CATALINA_HOME" + . "$CATALINA_HOME"/bin/setclasspath.sh +else + echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh" + echo "This file is needed to run this program" + exit 1 +fi + +# Add on extra jar files to CLASSPATH +CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$BASEDIR"/lib/servlet-api.jar + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + CATALINA_HOME=`cygpath --path --windows "$CATALINA_HOME"` + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` +fi + +# ----- Execute The Requested Command ----------------------------------------- + +exec "$_RUNJAVA" $JAVA_OPTS $TOOL_OPTS \ + -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \ + -Dcatalina.home="$CATALINA_HOME" \ + org.apache.catalina.startup.Tool "$@" diff --git a/bin/version.bat b/bin/version.bat new file mode 100644 index 000000000..dac31b992 --- /dev/null +++ b/bin/version.bat @@ -0,0 +1,44 @@ +@echo off +if "%OS%" == "Windows_NT" setlocal +rem --------------------------------------------------------------------------- +rem Version script for the CATALINA Server +rem +rem $Id: version.bat 302987 2004-06-30 15:25:31Z funkman $ +rem --------------------------------------------------------------------------- + +rem Guess CATALINA_HOME if not defined +set CURRENT_DIR=%cd% +if not "%CATALINA_HOME%" == "" goto gotHome +set CATALINA_HOME=%CURRENT_DIR% +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +cd .. +set CATALINA_HOME=%cd% +cd %CURRENT_DIR% +:gotHome +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +set EXECUTABLE=%CATALINA_HOME%\bin\catalina.bat + +rem Check that target executable exists +if exist "%EXECUTABLE%" goto okExec +echo Cannot find %EXECUTABLE% +echo This file is needed to run this program +goto end +:okExec + +rem Get remaining unshifted command line arguments and save them in the +set CMD_LINE_ARGS= +:setArgs +if ""%1""=="""" goto doneSetArgs +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 +shift +goto setArgs +:doneSetArgs + +call "%EXECUTABLE%" version %CMD_LINE_ARGS% + +:end diff --git a/bin/version.sh b/bin/version.sh new file mode 100644 index 000000000..e7cdd61f2 --- /dev/null +++ b/bin/version.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# ----------------------------------------------------------------------------- +# Version Script for the CATALINA Server +# +# $Id: version.sh 385888 2006-03-14 21:04:40Z keith $ +# ----------------------------------------------------------------------------- + +# resolve links - $0 may be a softlink +PRG="$0" + +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done + +PRGDIR=`dirname "$PRG"` +EXECUTABLE=catalina.sh + +# Check that target executable exists +if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "This file is needed to run this program" + exit 1 +fi + +exec "$PRGDIR"/"$EXECUTABLE" version "$@" -- 2.11.0