Back to the Konsensys

Back to Tips
How to Shutdown Apache Tomcat on Linux
by
George Van Treeck

As you may be well aware, the shutdown.sh script provided in the bin directory of your Tomcat installation does not work. Tomcat docs even admit it doesn't work. But, they never fixed it for some reason. Below is short shutdown script I wrote that always works on Linux:

shutdown.sh

#!/bin/sh
TOMCAT_HOME=/usr/local/tomcat
pushd $TOMCAT_HOME
ps -ef | grep Bootstrap | grep -v grep | awk '{print $2}' > $TOMCAT_HOME/bin/tomcat.pid
export CATALINA_PID=$TOMCAT_HOME/bin/tomcat.pid
bin/shutdown.sh -force

You will have to set TOMCAT_HOME to your installation location.


Copyright (C) 2010 George Van Treeck. All rights reserved.