blob: 6211c9baa85dece4eff985b745fec135d72e3ee2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/tomcat/files/5.5/tomcat.init.2,v 1.7 2008/12/19 20:48:47 ali_bush Exp $
init_env_vars() {
if [ "$(gjl -p tomcat-5.5 --get-vm)" ] ; then
eerror "Tomcat has been compiled with java5 USE flag set."
eerror "Tomcat now requires a VM >=1.5 to run."
eerror "Please check your VM version, and restart Tomcat."
eend 1
fi
# Populate JAVA_HOME
JAVA_HOME=`java-config --jre-home`
# Set some sane defaults
if [ -z "${CATALINA_TMPDIR}" ] ; then
CATALINA_TMPDIR="${CATALINA_BASE}"/temp
fi
JPDA_TRANSPORT=${JPDA_TRANSPORT:="dt_socket"}
JPDA_ADDRESS=${JPDA_ADDRESS:="8000"}
JPDA_OPTS=${JPDA_OPTS="-Xdebug -Xrunjdwp:transport=${JPDA_TRANSPORT},address=${JPDA_ADDRESS},server=y,suspend=n"}
# Activate Logging
if [ -r "${CATALINA_HOME}"/bin/tomcat-juli.jar ]; then
JAVA_OPTS="${JAVA_OPTS} -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=${CATALINA_BASE}/conf/logging.properties"
fi
# Populate the classpath
CLASSPATH="${CLASSPATH}:${CATALINA_HOME}/server/lib:${JAVA_HOME}/lib/tools.jar"
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"
OPTS_CP="${JAVA_OPTS} ${CATALINA_OPTS} \
-Djava.endorsed.dirs=${CATALINA_HOME}/common/endorsed \
-classpath ${CLASSPATH}"
CATALINA_ARGS="-Dcatalina.base=${CATALINA_BASE} \
-Dcatalina.home=${CATALINA_HOME} \
-Djava.io.tmpdir=${CATALINA_TMPDIR} \
org.apache.catalina.startup.Bootstrap "
if [ ! -f "${CATALINA_BASE}logs/catalina.out" ]; then
touch "${CATALINA_BASE}logs/catalina.out"
chown tomcat:tomcat "${CATALINA_BASE}logs/catalina.out"
fi
}
start_helper() {
local executor=${1}
shift
local arguments="--start --quiet \
--chdir "${CATALINA_TMPDIR}" \
--chuid ${CATALINA_USER}:${CATALINA_GROUP} \
--make-pidfile --pidfile /var/run/tomcat-5.5.pid"
start-stop-daemon ${arguments} --exec ${executor} -- ${OPTS_CP} "$@" \
${CATALINA_ARGS} ${TOMCAT_START} >> "${CATALINA_BASE}"/logs/catalina.out 2>&1 &
return $?
}
depend() {
use dns logger net
}
start() {
ebegin "Starting Tomcat"
init_env_vars
if [ ! -e "${CATALINA_TMPDIR}" ]; then
eerror "CATALINA_TMPDIR does not exist. Unable to start tomcat."
eerror "Please see /etc/conf.d/tomcat-6 for more information."
eend 1
fi
# Figure out what arguments to pass start_helper based on TOMCAT_START
if [ "${TOMCAT_START}" = "debug" ] ; then
start_helper ${JAVA_HOME}/bin/jdb \
-sourcepath ${CATALINA_HOME}/../../jakarta-tomcat-catalina/catalina/src/share
elif [ "${TOMCAT_START}" = "-security debug" ] ; then
start_helper ${JAVA_HOME}/bin/jdb \
-sourcepath ${CATALINA_HOME}/../../jakarta-tomcat-catalina/catalina/src/share \
-Djava.security.manager \
-Djava.security.policy=${CATALINA_BASE}/conf/catalina.policy
elif [ "${TOMCAT_START}" = "jpda start" ] ; then
start_helper ${JAVA_HOME}/bin/java ${JPDA_OPTS}
elif [ "${TOMCAT_START}" = "start" ] ; then
start_helper ${JAVA_HOME}/bin/java
elif [ "${TOMCAT_START}" = "-security start" ] ; then
start_helper ${JAVA_HOME}/bin/java \
-Djava.security.manager \
-Djava.security.policy=${CATALINA_BASE}/conf/catalina.policy
else
eerror "Invalid TOMCAT_START variable value, or one is not set"
eerror "Please see /etc/conf.d/tomcat-5.5 for more information"
eend 1
fi
eend $?
}
stop() {
ebegin "Stopping Tomcat"
init_env_vars
start-stop-daemon --stop --quiet \
--make-pidfile --pidfile /var/run/tomcat-5.5.pid \
--exec ${JAVA_HOME}/bin/java -- ${OPTS_CP} ${CATALINA_ARGS} ${STD_OUT} stop
eend $?
}
|