You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by camccuk <ca...@yahoo.com> on 2002/03/20 11:50:29 UTC

Repost: Finding Tomcat PID (Was Figuring out which Unix process is which)

Hello all,

Sorry to repost but this seems to be relevant and something some people are
having a problem with. My original post was:

---------------------------------------------------------
I've had a small script running for a while that
basically runs ps -auxfwww and greps the output for
'catalina', mailing me if the process has fallen over.
(The extra w options make the process name long enough
to fit in the whole catalina command line).

However, this only works until the java process gets
swapped out, at which point ps reports the process as
[java] - there is no way around this that I know of
despite several posts to groups etc. 

So I think I need a script to launch catalina and
store the pid somewhere that I can use killall 0 on -
this is apparently the 'correct' way to check a
process is running. 
---------------------------------------------------------

If this swapping out problem doesn't happen for you Toav, perhaps this is the
way to go: use extra 'w's in your ps command - they accumulate (despite there
being no clue to this in the manpage).

Can anyone who knows Tomcat well comment on these other possibilities?

--- Ralph Einfeldt <ra...@uptime-isc.de> wrote:
> What we do, is to define a command line option that shows 
> up at the beginning of the command string that identifies
> the site for which this vm is running.
> 
> As we don't use tomcat, I can't tell you how to achieve 
> this with tomcat.
> 
> 
> jserv.properties:
>   wrapper.bin.parameters=-DName=<sitename>
> 
> 
> Another way to identify: 
>   look for a VM that connects to a given port.
> 
> Under linux it lsof -i :<port>.
> Don't know how if lsof is part of the standard 
> distribution for solaris. (Last time I've worked 
> with that is over 3 years ago)

lsof only shows a plain command (e.g. java) in the left hand column...

> > -----Urspr�ngliche Nachricht-----
> > Von: Yoav Shapira [mailto:shapira@mpi.com]
> > Gesendet: Dienstag, 19. M�rz 2002 21:52
> > An: tomcat-user@jakarta.apache.org
> > Betreff: Figuring out which Unix process is which
> <snip/>
> > We run multiple instance of tomcat using the same JAVA_HOME,
> > so when we run a ps command (Solaris 2.8) we see a bunch
> > of java processes, but can't tell which one is which instance
> > of tomcat.  Does anyone have any ideas to help this problem?
> <snip/>

It seems to me that storing the pid is probably the most robust method - I just
haven't had a chance to try writing a script yet. Can anyone suggest other ways
to approach this? 

Cheers,
cam

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Repost: Finding Tomcat PID (Was Figuring out which Unix process is which)

Posted by David Cassidy <dc...@nisports.com>.
Ralph,

you could always use something like wget that will actually get a page from catalina
then if you get no output then trigger an alert.

that will check that the service is actually able to serve requests rather
than just running ...

You could make the page that it requests a 'lets check all the services' type
page so that you can check that the connection to the database etc are still
all working ...

D





camccuk wrote:

>Hello all,
>
>Sorry to repost but this seems to be relevant and something some people are
>having a problem with. My original post was:
>
>---------------------------------------------------------
>I've had a small script running for a while that
>basically runs ps -auxfwww and greps the output for
>'catalina', mailing me if the process has fallen over.
>(The extra w options make the process name long enough
>to fit in the whole catalina command line).
>
>However, this only works until the java process gets
>swapped out, at which point ps reports the process as
>[java] - there is no way around this that I know of
>despite several posts to groups etc. 
>
>So I think I need a script to launch catalina and
>store the pid somewhere that I can use killall 0 on -
>this is apparently the 'correct' way to check a
>process is running. 
>---------------------------------------------------------
>
>If this swapping out problem doesn't happen for you Toav, perhaps this is the
>way to go: use extra 'w's in your ps command - they accumulate (despite there
>being no clue to this in the manpage).
>
>Can anyone who knows Tomcat well comment on these other possibilities?
>
>--- Ralph Einfeldt <ra...@uptime-isc.de> wrote:
>
>>What we do, is to define a command line option that shows 
>>up at the beginning of the command string that identifies
>>the site for which this vm is running.
>>
>>As we don't use tomcat, I can't tell you how to achieve 
>>this with tomcat.
>>
>>
>>jserv.properties:
>>  wrapper.bin.parameters=-DName=<sitename>
>>
>>
>>Another way to identify: 
>>  look for a VM that connects to a given port.
>>
>>Under linux it lsof -i :<port>.
>>Don't know how if lsof is part of the standard 
>>distribution for solaris. (Last time I've worked 
>>with that is over 3 years ago)
>>
>
>lsof only shows a plain command (e.g. java) in the left hand column...
>
>>>-----Ursprüngliche Nachricht-----
>>>Von: Yoav Shapira [mailto:shapira@mpi.com]
>>>Gesendet: Dienstag, 19. März 2002 21:52
>>>An: tomcat-user@jakarta.apache.org
>>>Betreff: Figuring out which Unix process is which
>>>
>><snip/>
>>
>>>We run multiple instance of tomcat using the same JAVA_HOME,
>>>so when we run a ps command (Solaris 2.8) we see a bunch
>>>of java processes, but can't tell which one is which instance
>>>of tomcat.  Does anyone have any ideas to help this problem?
>>>
>><snip/>
>>
>
>It seems to me that storing the pid is probably the most robust method - I just
>haven't had a chance to try writing a script yet. Can anyone suggest other ways
>to approach this? 
>
>Cheers,
>cam
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Sports - live college hoops coverage
>http://sports.yahoo.com/
>
>--
>To unsubscribe:   <ma...@jakarta.apache.org>
>For additional commands: <ma...@jakarta.apache.org>
>Troubles with the list: <ma...@jakarta.apache.org>
>



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>