File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes tomcat pid in linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat pid in linux" Watch "tomcat pid in linux" New topic
Author

tomcat pid in linux

Jhun Hoon
Greenhorn

Joined: Nov 19, 2001
Posts: 28
Dear all !

Hi, i'm wondering if i can run tomcat in specific pid, so it'll be easier for me to kill tomcat in linux with a simple shell script.

So far, if the tomcat cannot be shutdown for some reasons, i had to issue 'ps auwx | grep tomcat' and then kill -9 the pids.

Please advise

Wishing you all well !
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
It is already easy enough to kill with a script. For one, the pid is contained in a file, either under the Tomcat directory, or somewhere under var, inspect the catalina.sh and/or setenv.sh scripts to find out exactly where.
Jhun Hoon
Greenhorn

Joined: Nov 19, 2001
Posts: 28
Quack !
I'm quite embarassed about this, the solution is already in catalina.sh
Thanks alot !

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

Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
Also, your best bet is to call catalina.sh stop from a script, wait for a few seconds, then check whether the pid file is still there, and the pid it contains is still active, then kill it if it is. But 99% of the time catalina.sh stop works without a problem. The only time I have seen it not work, is when I have changed something with the configuration while the server was running, that then caused problem with the shutdown.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat pid in linux