tomcat 7 配置内存大小

来源:互联网 发布:众筹行业数据报告 编辑:程序博客网 时间:2024/05/23 19:20
set JAVA_OPTS=-Xms1024m -Xmx1024m -Xss1024K -XX:PermSize=256m-XX:MaxPermSize=512m 
@echo off
rem Licensed to the Apache Software Foundation (ASF) under oneor more
rem contributor license agreements.  See theNOTICE file distributed with
rem this work for additional information regarding copyrightownership.
rem The ASF licenses this file to You under the ApacheLicense, Version 2.0
rem (the "License"); you may not use this file except incompliance with
rem the License.  You may obtain a copy ofthe License at
rem
rem    http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing,software
rem distributed under the License is distributed on an "AS IS"BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eitherexpress or implied.
rem See the License for the specific language governingpermissions and
rem limitations under the License.

rem---------------------------------------------------------------------------
rem Start/Stop Script for the CATALINA Server
rem
rem Environment Variable Prerequisites
rem
rem   Do not set the variables in thisscript. Instead put them into a script
rem   setenv.bat in CATALINA_BASE/bin to keepyour customizations separate.
rem
rem   CATALINA_HOME   Maypoint at your Catalina "build" directory.
rem
rem   CATALINA_BASE  (Optional) Base directory for resolving dynamic portions
rem                 of aCatalina installation.  If not present, resolvesto
rem                 the samedirectory that CATALINA_HOME points to.
rem
rem   CATALINA_OPTS  (Optional) Java runtime options used when the "start",
rem                 "run" or"debug" command is executed.
rem                 Includehere and not in JAVA_OPTS all options, that should
rem                 only beused by Tomcat itself, not by the stop process,
rem                 theversion command etc.
rem                 Examplesare heap size, GC logging, JMX ports etc.
rem
rem   CATALINA_TMPDIR (Optional) Directorypath location of temporary directory
rem                 the JVMshould use (java.io.tmpdir).  Defaults to
rem                %CATALINA_BASE%\temp.
rem
rem   JAVA_HOME      Must point at your JavaDevelopment Kit installation.
rem                 Requiredto run the with the "debug" argument.
rem
rem   JRE_HOME       Must pointat your Java Runtime installation.
rem                 Defaultsto JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
rem                 are bothset, JRE_HOME is used.
rem
rem   JAVA_OPTS      (Optional) Java runtimeoptions used when any command
rem                 isexecuted.
rem                 Includehere and not in CATALINA_OPTS all options, that
rem                 should beused by Tomcat and also by the stop process,
rem                 theversion command etc.
rem                 Mostoptions should go into CATALINA_OPTS.
rem
rem   JAVA_ENDORSED_DIRS (Optional) Lists ofof semi-colon separated directories
rem                 containingsome jars in order to allow replacement of APIs
rem                 createdoutside of the JCP (i.e. DOM and SAX from W3C).
rem                 It canalso be used to update the XML parser implementation.
rem                 Defaultsto $CATALINA_HOME/endorsed.
rem
rem   JPDA_TRANSPORT (Optional) JPDA transport used when the "jpdastart"
rem                 command isexecuted. The default is "dt_socket".
rem
rem   JPDA_ADDRESS   (Optional) Java runtime options used when the"jpda start"
rem                 command isexecuted. The default is 8000.
rem
rem   JPDA_SUSPEND   (Optional) Java runtime options used when the"jpda start"
rem                 command isexecuted. Specifies whether JVM should suspend
rem                 executionimmediately after startup. Default is "n".
rem
rem   JPDA_OPTS      (Optional) Java runtimeoptions used when the "jpda start"
rem                 command isexecuted. If used, JPDA_TRANSPORT, JPDA_ADDRESS,
rem                 andJPDA_SUSPEND are ignored. Thus, all required jpda
rem                 optionsMUST be specified. The default is:
rem
rem                -agentlib:jdwp=transport=%JPDA_TRANSPORT%,
rem                   address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
rem
rem   LOGGING_CONFIG (Optional) Override Tomcat's logging configfile
rem                 Example(all one line)
rem                 setLOGGING_CONFIG="-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties"
rem
rem   LOGGING_MANAGER (Optional) OverrideTomcat's logging manager
rem                 Example(all one line)
rem                 setLOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
rem
rem   TITLE         (Optional) Specify the title of Tomcat window.The default
rem                 TITLE isTomcat if it's not specified.
rem                 Example(all one line)
rem                 setTITLE=Tomcat.Cluster#1.Server#1 [%DATE% %TIME%]
rem---------------------------------------------------------------------------

setlocal
rem Suppress Terminate batch job on CTRL+C
if not ""%1"" == ""run"" goto mainEntry
if "%TEMP%" == "" goto mainEntry
if exist "%TEMP%\%~nx0.run" goto mainEntry
echo Y>"%TEMP%\%~nx0.run"
if not exist "%TEMP%\%~nx0.run" goto mainEntry
echo Y>"%TEMP%\%~nx0.Y"
call "%~f0" %* <"%TEMP%\%~nx0.Y"
rem Use provided errorlevel
set RETVAL=%ERRORLEVEL%
del /Q "%TEMP%\%~nx0.Y" >NUL2>&1
exit /B %RETVAL%
:mainEntry
del /Q "%TEMP%\%~nx0.run" >NUL2>&1

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 definedcorrectly
echo This environment variable is needed to run thisprogram
goto end
:okHome

rem Copy CATALINA_BASE from CATALINA_HOME if not defined
if not "%CATALINA_BASE%" == "" goto gotBase
set "CATALINA_BASE=%CATALINA_HOME%"
:gotBase

rem Ensure that any user defined CLASSPATH variables are notused on startup,
rem but allow them to be specified in setenv.bat, in rare casewhen it is needed.
set CLASSPATH=

rem Get standard environment variables
if not exist "%CATALINA_BASE%\bin\setenv.bat" gotocheckSetenvHome
call "%CATALINA_BASE%\bin\setenv.bat"
goto setenvDone
:checkSetenvHome
if exist "%CATALINA_HOME%\bin\setenv.bat" call"%CATALINA_HOME%\bin\setenv.bat"
:setenvDone

rem Get standard Java environment variables
if exist "%CATALINA_HOME%\bin\setclasspath.bat" gotookSetclasspath
echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat"
echo This file is needed to run this program
goto end
:okSetclasspath
call "%CATALINA_HOME%\bin\setclasspath.bat" %1
if errorlevel 1 goto end

rem Add on extra jar file to CLASSPATH
rem Note that there are no quotes as we do not want tointroduce random
rem quotes into the CLASSPATH
if "%CLASSPATH%" == "" goto emptyClasspath
set "CLASSPATH=%CLASSPATH%;"
:emptyClasspath
set"CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar"

if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
set "CATALINA_TMPDIR=%CATALINA_BASE%\temp"
:gotTmpdir

rem Add tomcat-juli.jar to classpath
rem tomcat-juli.jar can be over-ridden per instance
if not exist "%CATALINA_BASE%\bin\tomcat-juli.jar" gotojuliClasspathHome
set"CLASSPATH=%CLASSPATH%;%CATALINA_BASE%\bin\tomcat-juli.jar"
goto juliClasspathDone
:juliClasspathHome
set"CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar"
:juliClasspathDone

if not "%LOGGING_CONFIG%" == "" goto noJuliConfig
set LOGGING_CONFIG=-Dnop
if not exist "%CATALINA_BASE%\conf\logging.properties" gotonoJuliConfig
setLOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
:noJuliConfig
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

if not "%LOGGING_MANAGER%" == "" goto noJuliManager
setLOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
:noJuliManager
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%

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
echo Using CLASSPATH:      "%CLASSPATH%"

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_socket
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=8000
:gotJpdaAddress
if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend
set JPDA_SUSPEND=n
:gotJpdaSuspend
if not "%JPDA_OPTS%" == "" goto gotJpdaOpts
setJPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
:gotJpdaOpts
shift
:noJpda

if ""%1"" == ""debug"" goto doDebug
if ""%1"" == ""run"" goto doRun
if ""%1"" == ""start"" goto doStart
if ""%1"" == ""stop"" goto doStop
if ""%1"" == ""configtest"" goto doConfigTest
if ""%1"" == ""version"" goto doVersion

echo Usage:  catalina ( commands ... )
echo commands:
echo   debug           Start Catalina in adebugger
echo   debug -security  Debug Catalina with a security manager
echo   jpda start       StartCatalina under JPDA debugger
echo   run             StartCatalina in the current window
echo   run -security    Start in the current window with securitymanager
echo   start           Start Catalina in a separatewindow
echo   start -security  Start in a separate window with security manager
echo   stop            StopCatalina
echo   configtest       Run a basicsyntax check on server.xml
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 "%TITLE%" == "" set TITLE=Tomcat
set _EXECJAVA=start "%TITLE%" %_RUNJAVA%
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
set CATALINA_OPTS=
goto execCmd

:doConfigTest
shift
set ACTION=configtest
set CATALINA_OPTS=
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 savethem 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%" == "" gotodoSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_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
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_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

:end

 
阅读(5309)| 评论(0)
0 0
原创粉丝点击