Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 16E2C9D43 for ; Tue, 19 Jun 2012 22:12:03 +0000 (UTC) Received: (qmail 68629 invoked by uid 500); 19 Jun 2012 22:11:59 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 68573 invoked by uid 500); 19 Jun 2012 22:11:59 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 68564 invoked by uid 99); 19 Jun 2012 22:11:59 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2012 22:11:59 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of aw@ice-sa.com designates 212.85.38.228 as permitted sender) Received: from [212.85.38.228] (HELO tor.combios.es) (212.85.38.228) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jun 2012 22:11:51 +0000 Received: from [192.168.245.129] (montserrat.wissensbank.com [212.85.37.175]) by tor.combios.es (Postfix) with ESMTPA id C2D64DA08D7 for ; Wed, 20 Jun 2012 00:11:28 +0200 (CEST) Message-ID: <4FE0F90A.2010107@ice-sa.com> Date: Wed, 20 Jun 2012 00:11:22 +0200 From: =?ISO-8859-1?Q?Andr=E9_Warnier?= Reply-To: Tomcat Users List User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Tomcat shutdown.sh troubleshooting on AS/400 References: <4FE0E7EE.6000009@touchtonecorp.com> In-Reply-To: <4FE0E7EE.6000009@touchtonecorp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit James Lampert wrote: > In my experience, Tomcat's "shutdown.sh" 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 > catalina.sh (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 : - shutdown.sh's main purpose is to locate and execute catalina.sh with the single argument "stop". - catalina.sh, 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 : (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, 127.0.0.1), 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 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 "catalina.sh 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: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org