Well, in that case, I will include here the content of a message posted by
Tim Funk on 6/13/2002, which has his solution for this, which I find pretty
neat.  Hopefully Tim doesn't mind, and I should add that this would break
portability, most notably on Windows machines.

On 6/13/2002, Tim Funk wrote:

For what its worth - I created (and use) a LifecycleListener that runs 
on startup which logs the process ID into a file called tomcat.pid. 
Which is created by a shell script called writepid.sh. Below is all the 
code to get this to work. This code also assumes your current working 
directory is $CATALINA_HOME.

--Begin code
import org.apache.catalina.LifecycleEvent;

/**
  * A helper for getting the PID of java so shutting down tomcat is MUCH
  * easier.
  */
public class PidLifeCycle implements org.apache.catalina.LifecycleListener {
      public void lifecycleEvent(LifecycleEvent event)  {
         if ("start".equals(event.getType())) {
            try {
             Runtime.getRuntime().exec("/bin/sh bin/writepid.sh");
            } catch(Throwable e) {
               e.printStackTrace();
            }
         }
      }
}
--End Code

The code above will launch the following shell script. Should be in the 
bin/ directory of your tomcat installation.
--Begin Shell script
echo $PPID > logs/tomcat.pid
--End Shell script

Then add the following into server.xml
--Begin server.xml snippet
<Listener className="PidLifeCycle" />
--End server.xml snippet

-Tim

====== end =======

Thanks, Tim!

John


> -----Original Message-----
> From: Anthony Milbourne [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 12:45 PM
> To: 'Tomcat Users List'
> Subject: RE: Running multiple tomcat instances ?????
> 
> 
> Hi John
> 
> I don't think this option is available under Solaris :-(.
> 
>               Anthony.
> 
> > -----Original Message-----
> > From:       Turner, John [SMTP:[EMAIL PROTECTED]]
> > Sent:       23 September 2002 16:17
> > To: 'Tomcat Users List'
> > Subject:    RE: Running multiple tomcat instances ?????
> > 
> > 
> > Not sure about Solaris, but on Linux you can add 
> "--cols=XXX" to the "ps"
> > command, where "XXX" is a numeric column width.  So, while "ps -ef"
> > doesn't
> > show much, "ps -ef --cols=300" will show you everything you 
> need to know.
> > 
> > 
> > John
> > 
> > 
> > > -----Original Message-----
> > > From: Raj Mettai [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, September 23, 2002 11:14 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: Running multiple tomcat instances ?????
> > > 
> > > 
> > > Hi,
> > > 
> > > what is the best way to run multiple tomcat instances on 
> > > single solaris
> > > box ? 
> > > 
> > > 1) Is it Installing multiple tomcats physically.
> > > 
> > > or else 
> > > 
> > > 2) Installing once and use different server.xml files to 
> > > start different
> > > instances.
> > > 
> > > any advantages for one over the other ?
> > > 
> > > Also, if I do use 2nd process, and if one of the tomcat 
> crashes, how
> > > would I know which tomcat is 
> > > running and which one crashed, because ps -ef|grep tomcat 
> listing is
> > > identical for both instances.
> > > 
> > > how do you know which instance is using which server.xml ?
> > > 
> > > 
> > > thanks 
> > > 
> > > -Raj
> > > 
> > 
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> 
> 
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
> www.mimesweeper.com
> **********************************************************************
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to