Created
May 19, 2011 19:25
-
-
Save ryanschwartz/981514 to your computer and use it in GitHub Desktop.
Patch Mac OS X's tomcat catalina.sh to remove the pidfile if the PID is not running
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- catalina.sh.dist 2011-05-19 19:22:30.000000000 +0000 | |
+++ catalina.sh 2011-05-19 19:22:45.000000000 +0000 | |
@@ -311,8 +311,14 @@ | |
if [ ! -z "$CATALINA_PID" ]; then | |
if [ -f "$CATALINA_PID" ]; then | |
- echo "PID file ($CATALINA_PID) found. Is Tomcat still running? Start aborted." | |
- exit 1 | |
+ RUNNING=`ps aux|grep \`cat $CATALINA_PID\`|grep [java]|wc -l` | |
+ if [ $RUNNING -eq 1 ]; then | |
+ echo "PID file ($CATALINA_PID) found. Is Tomcat still running? Start aborted." | |
+ exit 1 | |
+ else | |
+ echo "PID file ($CATALINA_PID) found, but PID is not running. Removing PID file." | |
+ rm $CATALINA_PID | |
+ fi | |
fi | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment