tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1498482 - /tomcat/trunk/bin/catalina.sh
Date Mon, 01 Jul 2013 14:34:27 GMT
Author: markt
Date: Mon Jul  1 14:34:27 2013
New Revision: 1498482

URL: http://svn.apache.org/r1498482
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54013
Give forced stop a short period (5s) to complete before returning.

Modified:
    tomcat/trunk/bin/catalina.sh

Modified: tomcat/trunk/bin/catalina.sh
URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1498482&r1=1498481&r2=1498482&view=diff
==============================================================================
--- tomcat/trunk/bin/catalina.sh (original)
+++ tomcat/trunk/bin/catalina.sh Mon Jul  1 14:34:27 2013
@@ -469,6 +469,7 @@ elif [ "$1" = "stop" ] ; then
     fi
   fi
 
+  KILL_SLEEP_INTERVAL=5
   if [ $FORCE -eq 1 ]; then
     if [ -z "$CATALINA_PID" ]; then
       echo "Kill failed: \$CATALINA_PID not set"
@@ -477,9 +478,22 @@ elif [ "$1" = "stop" ] ; then
         PID=`cat "$CATALINA_PID"`
         echo "Killing Tomcat with the PID: $PID"
         kill -9 $PID
-        rm -f "$CATALINA_PID" >/dev/null 2>&1
-        if [ $? != 0 ]; then
-          echo "Tomcat was killed but the PID file could not be removed."
+        while [ $KILL_SLEEP_INTERVAL -ge 0 ]; do
+            kill -0 `cat "$CATALINA_PID"` >/dev/null 2>&1
+            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."
+                fi
+                break
+            fi
+            if [ $KILL_SLEEP_INTERVAL -gt 0 ]; then
+                sleep 1
+            fi
+            KILL_SLEEP_INTERVAL=`expr $KILL_SLEEP_INTERVAL - 1 `
+        done
+        if [ $KILL_SLEEP_INTERVAL -gt 0 ]; then
+            echo "Tomcat has not been killed completely yet. The process might be waiting
on some system call or might be UNINTERRUPTIBLE."
         fi
       fi
     fi



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


Mime
View raw message