Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I've set up some shell scripts to auto-deploy a fresh war file to a tomcat server. I call the shellscript to stop tomcat (, and then I kill the catalina PID, however I've noticed that this takes about a minute to kill the process and the process is still running when my start up script is called. In my start up script I have a condition that will only start tomcat when tomcat isn't running. Since the old process is still active, tomcat won't be restarted if I keep this logic in there. I could always remove that condition, but I'm not sure what would happen with two tomcats running at once, even if its just for a few seconds.

My question is would kill -9 make the process terminate faster? Right now I'm just using kill without any signals. I've read that it basically tells the process to terminate immediately, is there anything I'd have to worry about if I terminate tomcat immediately? (maybe heap space not being properly released or something)

Thanks a ton!

share|improve this question

migrated from Aug 12 '13 at 17:48

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

Heap space will be properly released, no problem. However, if you have applications that take some time to shut down, they might do some database cleanup work - e.g. empty buffers etc. That might be what you want to have an eye on.

I consider it bad practice to rely on your application requiring long shutdown time, because on power failure it wouldn't have that time either, and you can't just leave an inconsistent system. Consider kill -9 to act like a power failure, just on that single process: The OS will terminate the process unconditionally, without any chance for it to clean up application level data (e.g. flush caches). Don't worry about the OS: Once killed, it will reclaim the resources that this process had allocated.

share|improve this answer
Thanks for your response! This is gonna be running late night so our apps won't be doing too much work if any, so I don't think the cleanup work will be too bad. – Gus Aug 12 '13 at 15:39

You must log in to answer this question.