Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Oct 2005 20:53:28 +0300
From:      Tomas Verbaitis <tomasv@megalogika.lt>
To:        freebsd-java@freebsd.org
Subject:   Tomcat 5.5 startup and shutdown.. again
Message-ID:  <20051020175328.GA7205@megalogika.lt>

next in thread | raw e-mail | index | archive | help

--OXfL5xGRrasGEqWY
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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=3D">> ${jakarta_tomcat%%TOMCAT_VERSION%%_stdout_log} \
        2>> ${jakarta_tomcat%%TOMCAT_VERSION%%_stderr_log} "
=20
-procname=3D"java"
+procname=3D"%%JAVA_HOME%%/bin/java"
+pidfile=3D"/var/run/tomcat%%TOMCAT_VERSION%%.pid"
 required_files=3D"${jakarta_tomcat%%TOMCAT_VERSION%%_catalina_home}/conf/s=
erver.xml"
=20
 command=3D"/usr/sbin/daemon"
-flags=3D"${command} ${java_command} start ${jakarta_tomcat%%TOMCAT_VERSION=
%%_flags} ${log_args}"
-
-stop_cmd=3D"jakarta_tomcat%%TOMCAT_VERSION%%_stop"
-
-jakarta_tomcat%%TOMCAT_VERSION%%_stop() {
-       echo "Stopping ${name}."
-       ${java_command} stop
-       wait_for_pids
-}
+flags=3D"-p ${pidfile} ${java_command} start ${jakarta_tomcat%%TOMCAT_VERS=
ION%%_flags} ${log_args}"
=20
 run_rc_command "$1"
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- Makefile.orig       Thu Sep 29 18:08:23 2005
+++ Makefile    Thu Oct 20 20:35:40 2005
@@ -64,7 +64,8 @@
                TOMCAT_HOME=3D${APP_HOME} \
                USER=3D${TOMCAT_USER} \
                STDOUT_LOG=3D${STDOUT_LOG} \
-               STDERR_LOG=3D${STDERR_LOG}
+               STDERR_LOG=3D${STDERR_LOG} \
+               JAVA_HOME=3D${JAVA_HOME}
=20
 REPLACE_FILES+=3D        ${PKGDIR}/pkg-install \
                ${PKGDIR}/pkg-deinstall
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

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 :)

--=20
Tomas "Verbaitis" Verbaitis ** http://megalogika.lt
* =C5=A1ita gudri be=C5=BEd=C5=BEion=C4=97 moka dirbti su kompiuteriu *

--OXfL5xGRrasGEqWY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDV9mXTZzwEIgdOiYRAgMyAJ4lHEMhusH4mCSIEv6svnqu1BR/CwCfQu6w
Y5bcslY1Su9YGkfYGhbVoXo=
=CBFH
-----END PGP SIGNATURE-----

--OXfL5xGRrasGEqWY--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051020175328.GA7205>