9 |
# SERVICE_NAME is a required value only if the service name is |
# SERVICE_NAME is a required value only if the service name is |
10 |
# different from 'tomcat' |
# different from 'tomcat' |
11 |
# |
# |
12 |
NAME="${SERVICE_NAME:-tomcat}" |
export NAME="${SERVICE_NAME:-tomcat}" |
13 |
|
|
14 |
#I'll bet this isn't required. |
#I'll bet this isn't required. |
15 |
# unset ISBOOT |
# unset ISBOOT |
42 |
. /etc/sysconfig/${NAME} |
. /etc/sysconfig/${NAME} |
43 |
fi |
fi |
44 |
|
|
|
function parseOptions() { |
|
|
options="" |
|
|
options="$options $( |
|
|
awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \ |
|
|
$TOMCAT_CFG |
|
|
)" |
|
|
if [ -r "/etc/sysconfig/${NAME}" ]; then |
|
|
options="$options $( |
|
|
awk '!/^#/ && !/^$/ { ORS=" "; |
|
|
print "export ", $0, ";" }' \ |
|
|
/etc/sysconfig/${NAME} |
|
|
)" |
|
|
fi |
|
|
TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}" |
|
|
} |
|
|
|
|
45 |
# See how we were called. |
# See how we were called. |
46 |
function start() { |
function start() { |
47 |
# fix permissions on the log and pid files |
# fix permissions on the log and pid files |
48 |
export CATALINA_PID="/var/run/${NAME}.pid" |
export CATALINA_PID="/var/run/${NAME}.pid" |
|
touch $CATALINA_PID 2>&1 |
|
|
if [ "$?" -eq "0" ]; then |
|
|
chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID |
|
|
fi |
|
49 |
|
|
50 |
touch $TOMCAT_LOG 2>&1 |
touch $TOMCAT_LOG 2>&1 |
51 |
if [ "$?" -eq "0" ]; then |
if [ "$?" -eq "0" ]; then |
52 |
chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG |
chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG |
53 |
fi |
fi |
54 |
|
|
|
parseOptions |
|
55 |
if [ "$SECURITY_MANAGER" = "true" ]; then |
if [ "$SECURITY_MANAGER" = "true" ]; then |
56 |
$SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start-security" >> $TOMCAT_LOG 2>&1 |
${TOMCAT_SCRIPT} start-security >> $TOMCAT_LOG 2>&1 |
57 |
else |
else |
58 |
$SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} start" >> $TOMCAT_LOG 2>&1 |
${TOMCAT_SCRIPT} start #>> $TOMCAT_LOG 2>&1 |
59 |
fi |
fi |
60 |
} |
} |
61 |
|
|
62 |
function stop() { |
function stop() { |
63 |
parseOptions |
${TOMCAT_SCRIPT} stop >> $TOMCAT_LOG 2>&1 |
|
$SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1 |
|
64 |
} |
} |
65 |
|
|
66 |
# See how we were called. |
# See how we were called. |