1 |
#!/bin/bash |
2 |
|
3 |
if [ -r /usr/share/java-utils/java-functions ]; then |
4 |
. /usr/share/java-utils/java-functions |
5 |
else |
6 |
echo "Can't read Java functions library, aborting" |
7 |
exit 1 |
8 |
fi |
9 |
|
10 |
# Get the tomcat config (use this for environment specific settings) |
11 |
if [ -z "${TOMCAT_CFG}" ]; then |
12 |
TOMCAT_CFG="/etc/tomcat/tomcat.conf" |
13 |
fi |
14 |
|
15 |
if [ -r "$TOMCAT_CFG" ]; then |
16 |
. $TOMCAT_CFG |
17 |
fi |
18 |
|
19 |
# Get instance specific config file |
20 |
if [ -r "/etc/sysconfig/${NAME}" ]; then |
21 |
. /etc/sysconfig/${NAME} |
22 |
fi |
23 |
|
24 |
set_javacmd |
25 |
# CLASSPATH munging |
26 |
if [ -n "$JSSE_HOME" ]; then |
27 |
CLASSPATH="${CLASSPATH}:$(build-classpath jcert jnet jsse 2>/dev/null)" |
28 |
fi |
29 |
CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/bootstrap.jar" |
30 |
CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/bin/tomcat-juli.jar" |
31 |
CLASSPATH="${CLASSPATH}:$(build-classpath commons-daemon 2>/dev/null)" |
32 |
|
33 |
if [ "$1" = "start" ]; then |
34 |
${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ |
35 |
-classpath "$CLASSPATH" \ |
36 |
-Dcatalina.base="$CATALINA_BASE" \ |
37 |
-Dcatalina.home="$CATALINA_HOME" \ |
38 |
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ |
39 |
-Djava.io.tmpdir="$CATALINA_TMPDIR" \ |
40 |
-Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ |
41 |
-Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ |
42 |
org.apache.catalina.startup.Bootstrap start \ |
43 |
>> ${CATALINA_BASE}/logs/catalina.out 2>&1 & |
44 |
if [ ! -z "$CATALINA_PID" ]; then |
45 |
echo $! > $CATALINA_PID |
46 |
fi |
47 |
elif [ "$1" = "start-security" ]; then |
48 |
${JAVACMD} $JAVA_OPTS $CATALINA_OPTS \ |
49 |
-classpath "$CLASSPATH" \ |
50 |
-Dcatalina.base="$CATALINA_BASE" \ |
51 |
-Dcatalina.home="$CATALINA_HOME" \ |
52 |
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ |
53 |
-Djava.io.tmpdir="$CATALINA_TMPDIR" \ |
54 |
-Djava.security.manager \ |
55 |
-Djava.security.policy=="${CATALINA_BASE}/conf/catalina.policy" \ |
56 |
-Djava.util.logging.config.file="${CATALINA_BASE}/conf/logging.properties" \ |
57 |
-Djava.util.logging.manager="org.apache.juli.ClassLoaderLogManager" \ |
58 |
org.apache.catalina.startup.Bootstrap start \ |
59 |
>> ${CATALINA_BASE}/logs/catalina.out 2>&1 & |
60 |
if [ ! -z "$CATALINA_PID" ]; then |
61 |
echo $! > $CATALINA_PID |
62 |
fi |
63 |
elif [ "$1" = "stop" ]; then |
64 |
${JAVACMD} $JAVA_OPTS \ |
65 |
-classpath "$CLASSPATH" \ |
66 |
-Dcatalina.base="$CATALINA_BASE" \ |
67 |
-Dcatalina.home="$CATALINA_HOME" \ |
68 |
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \ |
69 |
-Djava.io.tmpdir="$CATALINA_TMPDIR" \ |
70 |
org.apache.catalina.startup.Bootstrap stop \ |
71 |
>> ${CATALINA_BASE}/logs/catalina.out 2>&1 |
72 |
elif [ "$1" = "version" ]; then |
73 |
${JAVACMD} -classpath ${CATALINA_HOME}/lib/catalina.jar \ |
74 |
org.apache.catalina.util.ServerInfo |
75 |
else |
76 |
echo "Usage: $0 {start|start-security|stop|version}" |
77 |
exit 1 |
78 |
fi |