tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: How to get java process id of a user running tomcat
Date Thu, 03 Dec 2009 17:09:09 GMT
Me being the one who made the ridiculous suggestion of using ps, am now enlightened and will
be using jps -mlv and spreading the word...

That being said is there any opinions about the soundness of using the Redhat/Centos startup/shutdown
script for Tomcat?


-----Original Message-----
From: Christopher Schultz [] 
Sent: 02 December 2009 20:40
To: Tomcat Users List
Subject: Re: How to get java process id of a user running tomcat

Hash: SHA1


On 12/2/2009 1:30 AM, raj kumar wrote:
> When i ran tomcat and shut it down my java process is not closing along with
> shutdown.

See others' responses for why you should have to do this. Otherwise...

> i need to kill it explicitly. So  I would like to know how to
> identify the java process of the logged in user who started the server. so
> that i can kill the process id from the script itself.

You won't be using the script to kill Tomcat unless you hack
it up to do that. I'd recommend against that.

What I would recommend is using the CATALINA_PID environment variable
helpfully documented in bin/

# Environment Variable Prequisites
#   CATALINA_PID    (Optional) Path of the file which should contains
#                   the pid of catalina startup java process, when
#                   start (fork) is used

Try setting this environment variable to something like
"/var/run/" and you should get a file in that location
containing the pid of the Java process started by Tomcat.

Then, you can do something like:

$ kill -9 `cat /var/run/`

Forget all these ridiculous suggestions of running 'ps' and grepping the
output for all kinds of crazy strings. That may or may not work at all.
The above strategy was intended by the Tomcat developers to be used to
capture the PID of the Java process, so go ahead and use that.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


This email has been scanned by the MessageLabs Email Security System.
For more information please visit 
View raw message