https://issues.apache.org/bugzilla/show_bug.cgi?id=51309

             Bug #: 51309
           Summary: Patch to better stop support with CATALINA_PID
           Product: Tomcat 6
           Version: 6.0.32
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Native:Integration
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: raizd...@gmail.com
    Classification: Unclassified


When using the CATALINA_PID variable the catalina.sh stop action verify if the
PID file is empty (-s $CATALINA_PID) and after that verify if the file is a
file (-f $CATALINA_PID). But if the file doesn't exist the "test -s" return 1
consequently the message "\$CATALINA_PID was set but the specified file does
not exist. Is Tomcat running? Stop aborted." is never printed.

I made a patch to fix this, but what you need to do is just invert "-s" and
"-f".


PATCH:
--- catalina.sh.bkp    2011-06-01 12:02:07.541350449 -0300
+++ catalina.sh    2011-06-01 12:02:37.916302955 -0300
@@ -403,19 +403,19 @@
   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

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

Reply via email to