1 | @echo off |
---|
2 | rem Licensed to the Apache Software Foundation (ASF) under one or more |
---|
3 | rem contributor license agreements. See the NOTICE file distributed with |
---|
4 | rem this work for additional information regarding copyright ownership. |
---|
5 | rem The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
6 | rem (the "License"); you may not use this file except in compliance with |
---|
7 | rem the License. You may obtain a copy of the License at |
---|
8 | rem |
---|
9 | rem http://www.apache.org/licenses/LICENSE-2.0 |
---|
10 | rem |
---|
11 | rem Unless required by applicable law or agreed to in writing, software |
---|
12 | rem distributed under the License is distributed on an "AS IS" BASIS, |
---|
13 | rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
14 | rem See the License for the specific language governing permissions and |
---|
15 | rem limitations under the License. |
---|
16 | |
---|
17 | if "%OS%" == "Windows_NT" setlocal |
---|
18 | rem --------------------------------------------------------------------------- |
---|
19 | rem Start/Stop Script for the CATALINA Server |
---|
20 | rem |
---|
21 | rem Environment Variable Prequisites |
---|
22 | rem |
---|
23 | rem CATALINA_HOME May point at your Catalina "build" directory. |
---|
24 | rem |
---|
25 | rem CATALINA_BASE (Optional) Base directory for resolving dynamic portions |
---|
26 | rem of a Catalina installation. If not present, resolves to |
---|
27 | rem the same directory that CATALINA_HOME points to. |
---|
28 | rem |
---|
29 | rem CATALINA_OPTS (Optional) Java runtime options used when the "start", |
---|
30 | rem or "run" command is executed. |
---|
31 | rem |
---|
32 | rem CATALINA_TMPDIR (Optional) Directory path location of temporary directory |
---|
33 | rem the JVM should use (java.io.tmpdir). Defaults to |
---|
34 | rem %CATALINA_BASE%\temp. |
---|
35 | rem |
---|
36 | rem JAVA_HOME Must point at your Java Development Kit installation. |
---|
37 | rem Required to run the with the "debug" argument. |
---|
38 | rem |
---|
39 | rem JRE_HOME Must point at your Java Runtime installation. |
---|
40 | rem Defaults to JAVA_HOME if empty. |
---|
41 | rem |
---|
42 | rem JAVA_OPTS (Optional) Java runtime options used when the "start", |
---|
43 | rem "stop", or "run" command is executed. |
---|
44 | rem |
---|
45 | rem JSSE_HOME (Optional) May point at your Java Secure Sockets Extension |
---|
46 | rem (JSSE) installation, whose JAR files will be added to the |
---|
47 | rem system class path used to start Tomcat. |
---|
48 | rem |
---|
49 | rem JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start" |
---|
50 | rem command is executed. The default is "dt_shmem". |
---|
51 | rem |
---|
52 | rem JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start" |
---|
53 | rem command is executed. The default is "jdbconn". |
---|
54 | rem |
---|
55 | rem JPDA_SUSPEND (Optional) Java runtime options used when the "jpda start" |
---|
56 | rem command is executed. Specifies whether JVM should suspend |
---|
57 | rem execution immediately after startup. Default is "n". |
---|
58 | rem |
---|
59 | rem JPDA_OPTS (Optional) Java runtime options used when the "jpda start" |
---|
60 | rem command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS, |
---|
61 | rem and JPDA_SUSPEND are ignored. Thus, all required jpda |
---|
62 | rem options MUST be specified. The default is: |
---|
63 | rem |
---|
64 | rem -Xdebug -Xrunjdwp:transport=%JPDA_TRANSPORT%, |
---|
65 | rem address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND% |
---|
66 | rem |
---|
67 | rem $Id: catalina.bat 656834 2008-05-15 21:04:04Z markt $ |
---|
68 | rem --------------------------------------------------------------------------- |
---|
69 | |
---|
70 | rem Guess CATALINA_HOME if not defined |
---|
71 | set CURRENT_DIR=%cd% |
---|
72 | if not "%CATALINA_HOME%" == "" goto gotHome |
---|
73 | set CATALINA_HOME=%CURRENT_DIR% |
---|
74 | if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome |
---|
75 | cd .. |
---|
76 | set CATALINA_HOME=%cd% |
---|
77 | cd %CURRENT_DIR% |
---|
78 | :gotHome |
---|
79 | if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome |
---|
80 | echo The CATALINA_HOME environment variable is not defined correctly |
---|
81 | echo This environment variable is needed to run this program |
---|
82 | goto end |
---|
83 | :okHome |
---|
84 | |
---|
85 | rem Get standard environment variables |
---|
86 | if "%CATALINA_BASE%" == "" goto gotSetenvHome |
---|
87 | if exist "%CATALINA_BASE%\bin\setenv.bat" call "%CATALINA_BASE%\bin\setenv.bat" |
---|
88 | goto gotSetenvBase |
---|
89 | :gotSetenvHome |
---|
90 | if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat" |
---|
91 | :gotSetenvBase |
---|
92 | |
---|
93 | rem Get standard Java environment variables |
---|
94 | if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath |
---|
95 | echo Cannot find %CATALINA_HOME%\bin\setclasspath.bat |
---|
96 | echo This file is needed to run this program |
---|
97 | goto end |
---|
98 | :okSetclasspath |
---|
99 | set BASEDIR=%CATALINA_HOME% |
---|
100 | call "%CATALINA_HOME%\bin\setclasspath.bat" %1 |
---|
101 | if errorlevel 1 goto end |
---|
102 | |
---|
103 | rem Add on extra jar files to CLASSPATH |
---|
104 | if "%JSSE_HOME%" == "" goto noJsse |
---|
105 | set CLASSPATH=%CLASSPATH%;%JSSE_HOME%\lib\jcert.jar;%JSSE_HOME%\lib\jnet.jar;%JSSE_HOME%\lib\jsse.jar |
---|
106 | :noJsse |
---|
107 | set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar |
---|
108 | |
---|
109 | if not "%CATALINA_BASE%" == "" goto gotBase |
---|
110 | set CATALINA_BASE=%CATALINA_HOME% |
---|
111 | :gotBase |
---|
112 | |
---|
113 | if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir |
---|
114 | set CATALINA_TMPDIR=%CATALINA_BASE%\temp |
---|
115 | :gotTmpdir |
---|
116 | |
---|
117 | if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuli |
---|
118 | set JAVA_OPTS=%JAVA_OPTS% -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties" |
---|
119 | :noJuli |
---|
120 | |
---|
121 | rem ----- Execute The Requested Command --------------------------------------- |
---|
122 | |
---|
123 | echo Using CATALINA_BASE: %CATALINA_BASE% |
---|
124 | echo Using CATALINA_HOME: %CATALINA_HOME% |
---|
125 | echo Using CATALINA_TMPDIR: %CATALINA_TMPDIR% |
---|
126 | if ""%1"" == ""debug"" goto use_jdk |
---|
127 | echo Using JRE_HOME: %JRE_HOME% |
---|
128 | goto java_dir_displayed |
---|
129 | :use_jdk |
---|
130 | echo Using JAVA_HOME: %JAVA_HOME% |
---|
131 | :java_dir_displayed |
---|
132 | |
---|
133 | set _EXECJAVA=%_RUNJAVA% |
---|
134 | set MAINCLASS=org.apache.catalina.startup.Bootstrap |
---|
135 | set ACTION=start |
---|
136 | set SECURITY_POLICY_FILE= |
---|
137 | set DEBUG_OPTS= |
---|
138 | set JPDA= |
---|
139 | |
---|
140 | if not ""%1"" == ""jpda"" goto noJpda |
---|
141 | set JPDA=jpda |
---|
142 | if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport |
---|
143 | set JPDA_TRANSPORT=dt_shmem |
---|
144 | :gotJpdaTransport |
---|
145 | if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress |
---|
146 | set JPDA_ADDRESS=jdbconn |
---|
147 | :gotJpdaAddress |
---|
148 | if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend |
---|
149 | set JPDA_SUSPEND=n |
---|
150 | :gotJpdaSuspend |
---|
151 | if not "%JPDA_OPTS%" == "" goto gotJpdaOpts |
---|
152 | set JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND% |
---|
153 | :gotJpdaOpts |
---|
154 | shift |
---|
155 | :noJpda |
---|
156 | |
---|
157 | if ""%1"" == ""debug"" goto doDebug |
---|
158 | if ""%1"" == ""run"" goto doRun |
---|
159 | if ""%1"" == ""start"" goto doStart |
---|
160 | if ""%1"" == ""stop"" goto doStop |
---|
161 | if ""%1"" == ""version"" goto doVersion |
---|
162 | |
---|
163 | echo Usage: catalina ( commands ... ) |
---|
164 | echo commands: |
---|
165 | echo debug Start Catalina in a debugger |
---|
166 | echo debug -security Debug Catalina with a security manager |
---|
167 | echo jpda start Start Catalina under JPDA debugger |
---|
168 | echo run Start Catalina in the current window |
---|
169 | echo run -security Start in the current window with security manager |
---|
170 | echo start Start Catalina in a separate window |
---|
171 | echo start -security Start in a separate window with security manager |
---|
172 | echo stop Stop Catalina |
---|
173 | echo version What version of tomcat are you running? |
---|
174 | goto end |
---|
175 | |
---|
176 | :doDebug |
---|
177 | shift |
---|
178 | set _EXECJAVA=%_RUNJDB% |
---|
179 | set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\java" |
---|
180 | if not ""%1"" == ""-security"" goto execCmd |
---|
181 | shift |
---|
182 | echo Using Security Manager |
---|
183 | set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy |
---|
184 | goto execCmd |
---|
185 | |
---|
186 | :doRun |
---|
187 | shift |
---|
188 | if not ""%1"" == ""-security"" goto execCmd |
---|
189 | shift |
---|
190 | echo Using Security Manager |
---|
191 | set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy |
---|
192 | goto execCmd |
---|
193 | |
---|
194 | :doStart |
---|
195 | shift |
---|
196 | if not "%OS%" == "Windows_NT" goto noTitle |
---|
197 | set _EXECJAVA=start "Tomcat" %_RUNJAVA% |
---|
198 | goto gotTitle |
---|
199 | :noTitle |
---|
200 | set _EXECJAVA=start %_RUNJAVA% |
---|
201 | :gotTitle |
---|
202 | if not ""%1"" == ""-security"" goto execCmd |
---|
203 | shift |
---|
204 | echo Using Security Manager |
---|
205 | set SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy |
---|
206 | goto execCmd |
---|
207 | |
---|
208 | :doStop |
---|
209 | shift |
---|
210 | set ACTION=stop |
---|
211 | set CATALINA_OPTS= |
---|
212 | goto execCmd |
---|
213 | |
---|
214 | :doVersion |
---|
215 | %_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" org.apache.catalina.util.ServerInfo |
---|
216 | goto end |
---|
217 | |
---|
218 | |
---|
219 | :execCmd |
---|
220 | rem Get remaining unshifted command line arguments and save them in the |
---|
221 | set CMD_LINE_ARGS= |
---|
222 | :setArgs |
---|
223 | if ""%1""=="""" goto doneSetArgs |
---|
224 | set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 |
---|
225 | shift |
---|
226 | goto setArgs |
---|
227 | :doneSetArgs |
---|
228 | |
---|
229 | rem Execute Java with the applicable properties |
---|
230 | if not "%JPDA%" == "" goto doJpda |
---|
231 | if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity |
---|
232 | %_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% |
---|
233 | goto end |
---|
234 | :doSecurity |
---|
235 | %_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% |
---|
236 | goto end |
---|
237 | :doJpda |
---|
238 | if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda |
---|
239 | %_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% |
---|
240 | goto end |
---|
241 | :doSecurityJpda |
---|
242 | %_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% |
---|
243 | goto end |
---|
244 | |
---|
245 | :end |
---|