Tomcat 5.5 startup and shutdown.. again

Tomas Verbaitis tomasv at megalogika.lt
Thu Oct 20 10:53:30 PDT 2005


ahoj!

I looked through the new Tomcat startup script and noticed it does not
really interact with tomcat55ctl program:

*   rcNG script uses org.apache.catalina.startup.Bootstrap both for
    starting and stopping; therefore it does not honor
    /var/run/tomcat55.pid
*   tomcat55ctl uses org.apache.catalina.startup.Bootstrap to start
    Tomcat, to stop it just sends a SIGTERM to the running process.

Having both tools available can create some mess: you can launch at
least two copies of Tomcat using both tools, you can not stop Tomcat
launched with rcNG script using tomcat55ctl and vice versa.

Then i checked org.apache.catalina.startup.Catalina and found that it
doesn't do anything spectacular at shutdown: it just calls stop(), which
is also called when CatalinaShutdownHook() is run. Hence, i assume, it's
equally safe to stop Tomcat by sending it a SIGTERM.

This would also simplify rcNG script, as it could use default
/etc/rc.subr functions.

Proposed patch follows:
==================================================================================================
--- tomcat.sh.in.orig   Wed Sep 14 15:30:23 2005
+++ tomcat.sh.in        Thu Oct 20 20:18:32 2005
@@ -98,18 +98,11 @@
 log_args=">> ${jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log} \
        2>> ${jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log} "
 
-procname="java"
+procname="%%JAVA_HOME%%/bin/java"
+pidfile="/var/run/tomcat%%TOMCAT_VERSION%%.pid"
 required_files="${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home}/conf/server.xml"
 
 command="/usr/sbin/daemon"
-flags="${command} ${java_command} start ${jakarta_tomcat%%TOMCAT_VERSION%%_flags} ${log_args}"
-
-stop_cmd="jakarta_tomcat%%TOMCAT_VERSION%%_stop"
-
-jakarta_tomcat%%TOMCAT_VERSION%%_stop() {
-       echo "Stopping ${name}."
-       ${java_command} stop
-       wait_for_pids
-}
+flags="-p ${pidfile} ${java_command} start ${jakarta_tomcat%%TOMCAT_VERSION%%_flags} ${log_args}"
 
 run_rc_command "$1"
==================================================================================================
--- Makefile.orig       Thu Sep 29 18:08:23 2005
+++ Makefile    Thu Oct 20 20:35:40 2005
@@ -64,7 +64,8 @@
                TOMCAT_HOME=${APP_HOME} \
                USER=${TOMCAT_USER} \
                STDOUT_LOG=${STDOUT_LOG} \
-               STDERR_LOG=${STDERR_LOG}
+               STDERR_LOG=${STDERR_LOG} \
+               JAVA_HOME=${JAVA_HOME}
 
 REPLACE_FILES+=        ${PKGDIR}/pkg-install \
                ${PKGDIR}/pkg-deinstall
==================================================================================================

If port maintainers think it makes sense, i can file a PR, so this
proposal does not get forgotten -- Herve promised not to touch tomcat55
until other Tomcat ports are fixed, so it can take time :)

-- 
Tomas "Verbaitis" Verbaitis ** http://megalogika.lt
* šita gudri beždžionė moka dirbti su kompiuteriu *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-java/attachments/20051020/239a05da/attachment.bin


More information about the freebsd-java mailing list