Howdy, Note that the premise of your question is flawed without a precise definition of "starting up" and "shutting down." Consider a tomcat instance with N webapps, each of which with one ServletContextListener. Tomcat on startup will send the contextInitialized event to each of these listeners. Each listener may do things that take a long time, and may or may not do them in the background.
In the above scenario, when is the "starting up" state over and the "started" state entered? Is it when tomcat sends all N events, or when all N events are done processing? Similar scenarios can easily be construed for shutting down, and they are not limited to listeners as filters and servlets can all do varying amounts of processing on startup and shutdown. All of this may not matter in your scenario, so you may not have to worry about it at all ;) But they are important to keep in mind if you're trying to come up with some sort of general solution. Yoav Shapira --- "Francisco J. Bido" <[EMAIL PROTECTED]> wrote: > That's a good idea. Thanks! > > Take care, > -FB > > > On Saturday, June 7, 2003, at 03:23 PM, Tim Funk wrote: > > > The easy kluge is to hack the startup scripts (or write wrappers) > > around the startup scripts to maintain this status in some file, for > > arguements sake: cowbell.txt > > > > In startup.sh --> echo "starting" > cowbell.txt > > In startup.sh, a timer does wgets on a static asset. Once the asset is > > returned correctly: echo "started" > cowbell.txt > > > > In shutdown.sh --> echo "stopping" > cowbell.txt > > In shutdown.sh --> A timer looking for the java process id. Once the > > process ID is gone, echo "stopped" > cowbell.txt > > > > > > -Tim > > > > Francisco J. Bido wrote: > >> Thanks Tim, > >> Those suggestions work pretty well for checking the "running" and the > >> "stopped" states. The ones giving me a headache are really "starting > >> up" and "shutting down". The only thing I can think of at this > >> point is to monitor the size of catalina.out and trigger an event > >> went it doesn't change. > >> This is nasty since many things can cause the file to appear idle > >> i.e., a busy CPU. Any thoughts on these assessing these remaining > >> states? > >> -FB > >> On Saturday, June 7, 2003, at 02:41 PM, Tim Funk wrote: > >>> Depending on your needs if you just need UP or down, you can use > >>> wget or a similar agent. > >>> > >>> You can also set CATALINA_PID in unix before calling the startup > >>> scripts and the file referenced by CATALINA_PID will contain the > >>> process ID. > >>> > >>> Or you can write a LifeCycle Listener to trap startup and shutdown > >>> events. > >>> > >>> > >>> -Tim > >>> > >>> Francisco J. Bido wrote: > >>> > >>>> Is there any way to assess Tomcat's state via an environment > >>>> variable? For example, I would like to poll an environment > >>>> variable to see if Tomcat is: > >>>> 1. starting up > >>>> 2. running > >>>> 3. shutting down > >>>> 4. stopped > >>>> There're a bunch of other states out there but the above fulfill my > >>>> immediate needs. > >>>> Parsing through the catalina.out log file is the only way I know > >>>> how to do this but this is approach is way too clumsy and ugly. > >>>> Thanks! > >>>> -FB > >>>> > >>> > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: [EMAIL PROTECTED] > >>> For additional commands, e-mail: [EMAIL PROTECTED] > >>> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ===== Yoav Shapira [EMAIL PROTECTED] __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]