Linux – shutting down tomcat process smoothly in Linux

linuxtomcat

This has been bugging me for a while.

In my JSF development cycle, I do a lot of tomcat reload and sometimes to the point of restarting tomcat. I notice that at times, shutting down tomcat using shutdown.sh doesn't work, because when starting it via startup.sh says the address is already in use for port 8080. And in the linux shell, I have to do something like this:

ps auwx | grep -i tomcat
kill -9 <tomcatPid>

Is there any way to be able to shutdown tomcat cleanly, like the the tomcat service in Windows ?

I'm currently using opensuse linux 11.2, and I don't add my tomcat onto my services yet.
Still starting and shutdown it manually from the shell.

Best Answer

You can avoid 2 commands by simply running:

pkill -f catalina

to gracefully kill process matching with text catalina.

And to check whether catalina process is still running you can then do:

pgrep -fl catalina

And finally to kill with brute force try:

pkill -9 -f catalina