Develop and Download Open Source Software

Browse CVS Repository

Contents of /pal/pal-portal/installer/etc/tomcat/bin/catalina.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Sat Mar 10 23:18:48 2007 UTC (17 years ago) by shinsuke
Branch: MAIN
CVS Tags: RELEASE-1_0_BETA4
Changes since 1.1: +2 -2 lines
File MIME type: text/x-sh
modified JAVA_OPTS

1 #!/bin/sh
2 # -----------------------------------------------------------------------------
3 # Start/Stop Script for the CATALINA Server
4 #
5 # Environment Variable Prequisites
6 #
7 # CATALINA_HOME May point at your Catalina "build" directory.
8 #
9 # CATALINA_BASE (Optional) Base directory for resolving dynamic portions
10 # of a Catalina installation. If not present, resolves to
11 # the same directory that CATALINA_HOME points to.
12 #
13 # CATALINA_OPTS (Optional) Java runtime options used when the "start",
14 # "stop", or "run" command is executed.
15 #
16 # CATALINA_TMPDIR (Optional) Directory path location of temporary directory
17 # the JVM should use (java.io.tmpdir). Defaults to
18 # $CATALINA_BASE/temp.
19 #
20 # JAVA_HOME Must point at your Java Development Kit installation.
21 # Required to run the with the "debug" or "javac" argument.
22 #
23 # JRE_HOME Must point at your Java Development Kit installation.
24 # Defaults to JAVA_HOME if empty.
25 #
26 # JAVA_OPTS (Optional) Java runtime options used when the "start",
27 # "stop", or "run" command is executed.
28 #
29 # JPDA_TRANSPORT (Optional) JPDA transport used when the "jpda start"
30 # command is executed. The default is "dt_socket".
31 #
32 # JPDA_ADDRESS (Optional) Java runtime options used when the "jpda start"
33 # command is executed. The default is 8000.
34 #
35 # JSSE_HOME (Optional) May point at your Java Secure Sockets Extension
36 # (JSSE) installation, whose JAR files will be added to the
37 # system class path used to start Tomcat.
38 #
39 # CATALINA_PID (Optional) Path of the file which should contains the pid
40 # of catalina startup java process, when start (fork) is used
41 #
42 # $Id: catalina.sh,v 1.1 2007/03/10 01:16:18 shinsuke Exp $
43 # -----------------------------------------------------------------------------
44
45 JAVA_OPTS="$JAVA_OPTS -Xmx256m -Xms256m -XX:PermSize=256m -XX:MaxPermSize=256m -Djava.awt.headless=true"
46
47 # OS specific support. $var _must_ be set to either true or false.
48 cygwin=false
49 os400=false
50 darwin=false
51 case "`uname`" in
52 CYGWIN*) cygwin=true;;
53 OS400*) os400=true;;
54 Darwin*) darwin=true;;
55 esac
56
57 # resolve links - $0 may be a softlink
58 PRG="$0"
59
60 while [ -h "$PRG" ]; do
61 ls=`ls -ld "$PRG"`
62 link=`expr "$ls" : '.*-> \(.*\)$'`
63 if expr "$link" : '/.*' > /dev/null; then
64 PRG="$link"
65 else
66 PRG=`dirname "$PRG"`/"$link"
67 fi
68 done
69
70 # Get standard environment variables
71 PRGDIR=`dirname "$PRG"`
72
73 # Only set CATALINA_HOME if not already set
74 [ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
75
76 if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
77 . "$CATALINA_HOME"/bin/setenv.sh
78 fi
79
80 # For Cygwin, ensure paths are in UNIX format before anything is touched
81 if $cygwin; then
82 [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
83 [ -n "$JRE_HOME" ] && JRE_HOME=`cygpath --unix "$JRE_HOME"`
84 [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
85 [ -n "$CATALINA_BASE" ] && CATALINA_BASE=`cygpath --unix "$CATALINA_BASE"`
86 [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
87 [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --unix "$JSSE_HOME"`
88 fi
89
90 # For OS400
91 if $os400; then
92 # Set job priority to standard for interactive (interactive - 6) by using
93 # the interactive priority - 6, the helper threads that respond to requests
94 # will be running at the same priority as interactive jobs.
95 COMMAND='chgjob job('$JOBNAME') runpty(6)'
96 system $COMMAND
97
98 # Enable multi threading
99 export QIBM_MULTI_THREADED=Y
100 fi
101
102 # Get standard Java environment variables
103 if $os400; then
104 # -r will Only work on the os400 if the files are:
105 # 1. owned by the user
106 # 2. owned by the PRIMARY group of the user
107 # this will not work if the user belongs in secondary groups
108 BASEDIR="$CATALINA_HOME"
109 . "$CATALINA_HOME"/bin/setclasspath.sh
110 else
111 if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
112 BASEDIR="$CATALINA_HOME"
113 . "$CATALINA_HOME"/bin/setclasspath.sh
114 else
115 echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
116 echo "This file is needed to run this program"
117 exit 1
118 fi
119 fi
120
121 # Add on extra jar files to CLASSPATH
122 if [ -n "$JSSE_HOME" ]; then
123 CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar
124 fi
125 CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar
126
127 if [ -z "$CATALINA_BASE" ] ; then
128 CATALINA_BASE="$CATALINA_HOME"
129 fi
130
131 if [ -z "$CATALINA_TMPDIR" ] ; then
132 # Define the java.io.tmpdir to use for Catalina
133 CATALINA_TMPDIR="$CATALINA_BASE"/temp
134 fi
135
136 # Bugzilla 37848: When no TTY is available, don't output to console
137 have_tty=0
138 if [ "`tty`" != "not a tty" ]; then
139 have_tty=1
140 fi
141
142 # For Cygwin, switch paths to Windows format before running java
143 if $cygwin; then
144 JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
145 JRE_HOME=`cygpath --absolute --windows "$JRE_HOME"`
146 CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"`
147 CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"`
148 CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"`
149 CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
150 [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --windows "$JSSE_HOME"`
151 JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`
152 fi
153
154 # Set juli LogManager if it is present
155 if [ -r "$CATALINA_HOME"/bin/tomcat-juli.jar ]; then
156 JAVA_OPTS="$JAVA_OPTS "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" "-Djava.util.logging.config.file="$CATALINA_BASE/conf/logging.properties"
157 fi
158
159 # ----- Execute The Requested Command -----------------------------------------
160
161 # Bugzilla 37848: only output this if we have a TTY
162 if [ $have_tty -eq 1 ]; then
163 echo "Using CATALINA_BASE: $CATALINA_BASE"
164 echo "Using CATALINA_HOME: $CATALINA_HOME"
165 echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"
166 if [ "$1" = "debug" -o "$1" = "javac" ] ; then
167 echo "Using JAVA_HOME: $JAVA_HOME"
168 else
169 echo "Using JRE_HOME: $JRE_HOME"
170 fi
171 fi
172
173 if [ "$1" = "jpda" ] ; then
174 if [ -z "$JPDA_TRANSPORT" ]; then
175 JPDA_TRANSPORT="dt_socket"
176 fi
177 if [ -z "$JPDA_ADDRESS" ]; then
178 JPDA_ADDRESS="8000"
179 fi
180 if [ -z "$JPDA_OPTS" ]; then
181 JPDA_OPTS="-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=n"
182 fi
183 CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
184 shift
185 fi
186
187 if [ "$1" = "debug" ] ; then
188 if $os400; then
189 echo "Debug command not available on OS400"
190 exit 1
191 else
192 shift
193 if [ "$1" = "-security" ] ; then
194 echo "Using Security Manager"
195 shift
196 exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
197 -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
198 -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \
199 -Djava.security.manager \
200 -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
201 -Dcatalina.base="$CATALINA_BASE" \
202 -Dcatalina.home="$CATALINA_HOME" \
203 -Djava.io.tmpdir="$CATALINA_TMPDIR" \
204 org.apache.catalina.startup.Bootstrap "$@" start
205 else
206 exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \
207 -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
208 -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \
209 -Dcatalina.base="$CATALINA_BASE" \
210 -Dcatalina.home="$CATALINA_HOME" \
211 -Djava.io.tmpdir="$CATALINA_TMPDIR" \
212 org.apache.catalina.startup.Bootstrap "$@" start
213 fi
214 fi
215
216 elif [ "$1" = "run" ]; then
217
218 shift
219 if [ "$1" = "-security" ] ; then
220 echo "Using Security Manager"
221 shift
222 exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
223 -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
224 -Djava.security.manager \
225 -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
226 -Dcatalina.base="$CATALINA_BASE" \
227 -Dcatalina.home="$CATALINA_HOME" \
228 -Djava.io.tmpdir="$CATALINA_TMPDIR" \
229 org.apache.catalina.startup.Bootstrap "$@" start
230 else
231 exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
232 -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
233 -Dcatalina.base="$CATALINA_BASE" \
234 -Dcatalina.home="$CATALINA_HOME" \
235 -Djava.io.tmpdir="$CATALINA_TMPDIR" \
236 org.apache.catalina.startup.Bootstrap "$@" start
237 fi
238
239 elif [ "$1" = "start" ] ; then
240
241 shift
242 touch "$CATALINA_BASE"/logs/catalina.out
243 if [ "$1" = "-security" ] ; then
244 echo "Using Security Manager"
245 shift
246 "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
247 -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
248 -Djava.security.manager \
249 -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \
250 -Dcatalina.base="$CATALINA_BASE" \
251 -Dcatalina.home="$CATALINA_HOME" \
252 -Djava.io.tmpdir="$CATALINA_TMPDIR" \
253 org.apache.catalina.startup.Bootstrap "$@" start \
254 >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
255
256 if [ ! -z "$CATALINA_PID" ]; then
257 echo $! > $CATALINA_PID
258 fi
259 else
260 "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
261 -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
262 -Dcatalina.base="$CATALINA_BASE" \
263 -Dcatalina.home="$CATALINA_HOME" \
264 -Djava.io.tmpdir="$CATALINA_TMPDIR" \
265 org.apache.catalina.startup.Bootstrap "$@" start \
266 >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
267
268 if [ ! -z "$CATALINA_PID" ]; then
269 echo $! > $CATALINA_PID
270 fi
271 fi
272
273 elif [ "$1" = "stop" ] ; then
274
275 shift
276 FORCE=0
277 if [ "$1" = "-force" ]; then
278 shift
279 FORCE=1
280 fi
281
282 "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
283 -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
284 -Dcatalina.base="$CATALINA_BASE" \
285 -Dcatalina.home="$CATALINA_HOME" \
286 -Djava.io.tmpdir="$CATALINA_TMPDIR" \
287 org.apache.catalina.startup.Bootstrap "$@" stop
288
289 if [ $FORCE -eq 1 ]; then
290 if [ ! -z "$CATALINA_PID" ]; then
291 echo "Killing: `cat $CATALINA_PID`"
292 kill -9 `cat $CATALINA_PID`
293 else
294 echo "Kill failed: \$CATALINA_PID not set"
295 fi
296 fi
297
298 elif [ "$1" = "version" ] ; then
299
300 "$_RUNJAVA" \
301 -classpath "$CATALINA_HOME/server/lib/catalina.jar" \
302 org.apache.catalina.util.ServerInfo
303
304 else
305
306 echo "Usage: catalina.sh ( commands ... )"
307 echo "commands:"
308 if $os400; then
309 echo " debug Start Catalina in a debugger (not available on OS400)"
310 echo " debug -security Debug Catalina with a security manager (not available on OS400)"
311 else
312 echo " debug Start Catalina in a debugger"
313 echo " debug -security Debug Catalina with a security manager"
314 fi
315 echo " jpda start Start Catalina under JPDA debugger"
316 echo " run Start Catalina in the current window"
317 echo " run -security Start in the current window with security manager"
318 echo " start Start Catalina in a separate window"
319 echo " start -security Start in a separate window with security manager"
320 echo " stop Stop Catalina"
321 echo " stop -force Stop Catalina (followed by kill -KILL)"
322 echo " version What version of tomcat are you running?"
323 exit 1
324
325 fi

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26