tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Gerhardus.Geldenh...@gta-travel.com>
Subject RE: How to get java process id of a user running tomcat
Date Thu, 03 Dec 2009 17:09:09 GMT
Hi
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?

Regards


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

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Phani,

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 shutdown.sh script itself.

You won't be using the shutdown.sh 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/catalina.sh:

# 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/tomcat.pid" 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/tomcat.pid`

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksW0KwACgkQ9CaO5/Lv0PA7uQCgxBiy3snTbF49e8FXPp/+qARn
qncAoI4/CLEItiHOiZxCioRfpHcCiGZ5
=AP2a
-----END PGP SIGNATURE-----

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Mime
View raw message