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 2014/01/13 16:20:59 UTC

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

Author: markt
Date: Mon Jan 13 15:20:59 2014
New Revision: 1557747

URL: http://svn.apache.org/r1557747
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=55743
Enable the stop script to work when the shutdown port is disabled and a PID file is defined.

Modified:
    tomcat/trunk/bin/catalina.sh

Modified: tomcat/trunk/bin/catalina.sh
URL: http://svn.apache.org/viewvc/tomcat/trunk/bin/catalina.sh?rev=1557747&r1=1557746&r2=1557747&view=diff
==============================================================================
--- tomcat/trunk/bin/catalina.sh (original)
+++ tomcat/trunk/bin/catalina.sh Mon Jan 13 15:20:59 2014
@@ -412,6 +412,8 @@ elif [ "$1" = "start" ] ; then
     echo $! > "$CATALINA_PID"
   fi
 
+  echo "Tomcat started."
+
 elif [ "$1" = "stop" ] ; then
 
   shift
@@ -455,6 +457,14 @@ elif [ "$1" = "stop" ] ; then
     -Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
     org.apache.catalina.startup.Bootstrap "$@" stop
 
+  # stop failed. Shutdown port disabled? Try a normal kill.
+  if [ $? != 0 ]; then
+    if [ ! -z "$CATALINA_PID" ]; then
+      echo "The stop command failed. Attempting to signal the process to stop through OS signal."
+      kill -15 `cat "$CATALINA_PID"` >/dev/null 2>&1
+    fi
+  fi
+
   if [ ! -z "$CATALINA_PID" ]; then
     if [ -f "$CATALINA_PID" ]; then
       while [ $SLEEP -ge 0 ]; do
@@ -467,9 +477,10 @@ elif [ "$1" = "stop" ] ; then
               # 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."
+              echo "The PID file could not be removed or cleared."
             fi
           fi
+          echo "Tomcat stopped."
           break
         fi
         if [ $SLEEP -gt 0 ]; then



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