You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/08/20 21:07:25 UTC

svn commit: r1515926 - /tomcat/trunk/bin/catalina.sh

Author: markt
Date: Tue Aug 20 19:07:25 2013
New Revision: 1515926

URL: http://svn.apache.org/r1515926
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55439
Don't try a forced stop (kill -9 $PID) if Tomcat has already been stopped and the PID file cleared else a bunch of errors will result.
Additionally, improve handling in a forced stop of situation when the PID file can be written to  but not deleted.

Modified:
    tomcat/trunk/bin/catalina.sh

Modified: tomcat/trunk/bin/catalina.sh
URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1515926&r1=1515925&r2=1515926&view=diff
==============================================================================
--- tomcat/trunk/bin/catalina.sh (original)
+++ tomcat/trunk/bin/catalina.sh Tue Aug 20 19:07:25 2013
@@ -450,6 +450,8 @@ elif [ "$1" = "stop" ] ; then
           if [ $? != 0 ]; then
             if [ -w "$CATALINA_PID" ]; then
               cat /dev/null > "$CATALINA_PID"
+              # If Tomcat has stopped don't try and force a stop with an empty PID file
+              FORCE=0
             else
               echo "Tomcat stopped but the PID file could not be removed or cleared."
             fi
@@ -484,7 +486,13 @@ elif [ "$1" = "stop" ] ; then
             if [ $? -gt 0 ]; then
                 rm -f "$CATALINA_PID" >/dev/null 2>&1
                 if [ $? != 0 ]; then
-                    echo "Tomcat was killed but the PID file could not be removed."
+                    if [ -w "$CATALINA_PID" ]; then
+                        cat /dev/null > "$CATALINA_PID"
+                    else
+                        echo "Tomcat was killed but the PID file could not be removed."
+                    fi
+                    # Set this to zero else a warning will be issued about the process still running
+                    KILL_SLEEP_INTERVAL=0
                 fi
                 break
             fi



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org