• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tomcat pid in linux

 
Jhun Hoon
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic