Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51309
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 2 Jun 2011 20:09:27 +0000 (20:09 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 2 Jun 2011 20:09:27 +0000 (20:09 +0000)
Correct logic in catalina.sh stop when using a PID file to ensure the correct message is shown.
Patch provided by Caio Cezar.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1130774 13f79535-47bb-0310-9956-ffa450edef68

bin/catalina.sh
webapps/docs/changelog.xml

index e07d0ec..0fdd968 100755 (executable)
@@ -412,19 +412,19 @@ elif [ "$1" = "stop" ] ; then
   fi
 
   if [ ! -z "$CATALINA_PID" ]; then
-    if [ -s "$CATALINA_PID" ]; then
-      if [ -f "$CATALINA_PID" ]; then
+    if [ -f "$CATALINA_PID" ]; then
+      if [ -s "$CATALINA_PID" ]; then
         kill -0 `cat "$CATALINA_PID"` >/dev/null 2>&1
         if [ $? -gt 0 ]; then
           echo "PID file found but no matching process was found. Stop aborted."
           exit 1
         fi
       else
-        echo "\$CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop aborted."
-        exit 1
+        echo "PID file is empty and has been ignored."
       fi
     else
-      echo "PID file is empty and has been ignored."
+      echo "\$CATALINA_PID was set but the specified file does not exist. Is Tomcat running? Stop aborted."
+      exit 1
     fi
   fi
 
index 0ecac3e..1c2f30b 100644 (file)
         <bug>46451</bug>: Configure svn:bugtraq properties for Tomcat trunk.
         Based on a patch provided by Marc Guillemot. (markt)
       </fix>
+      <fix>
+        <bug>51309</bug>: Correct logic in catalina.sh stop when using a PID
+        file to ensure the correct message is shown. Patch provided by Caio
+        Cezar. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>