tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Tomcat troubleshooting on AS/400
Date Tue, 19 Jun 2012 22:11:22 GMT
James Lampert wrote:
> In my experience, Tomcat's "" has never worked reliably on 
> AS/400, and I don't know why, or even understand enough about how it 
> works (or enough about shell scripts) to troubleshoot it.
> Here's the script. I can tell that it eventually transfers control to 
> (which is also what launches Tomcat), but that's about all I 
> can make out without help.

Without looking at the Tomcat Java code itself, this is my take on it :

-'s main purpose is to locate and execute with the single argument


-, when called with a "stop" argument (and without the "-force" option) :
   - starts another instance of the JVM, to run another instance of Tomcat, with the 
argument "stop". Let'scall this the "shutdowner" Tomcat.

- this other "shutdowner" instance of Tomcat parses the same conf/server.xml as the main 
tomcat instance, and in particular the tag :
	<Server port="8005" shutdown="SHUTDOWN"> (default values shown)
 From there, it picks up the "shutdown port" which the main Tomcat should have opened in 
LISTEN mode (iow a listening, server socket), and the string in the "shutdown" attribute.
Then this "shutdowner" Tomcat instance attempts to open a client connection to this port 
on localhost, and if succesful sends the picked-up shutdown string over that connection.

Back to the running Tomcat, which is listening on that server port.
It receives the connection request from the "shutdowner" Tomcat. If the connection is made

from the same host (localhost,, it accepts it.
If so, it next receives over that connection, the string sent by the "shutdowner" Tomcat,

compares that with the string in its own <Server> tag, and if they match, it starts

shutting itself down.

Back to the "shutdowner" Tomcat : when it has been succesful opening the connection to 
localhost:shutdown-port and sending the shutdown string over it, it closes the connection

and terminates. This also causes its own " stop" script to terminate.

And everyone is happy.
Of course, if anything in the sequence above misfires, someone will be unhappy.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message