Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48793
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 10 Mar 2010 16:46:46 +0000 (16:46 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 10 Mar 2010 16:46:46 +0000 (16:46 +0000)
Make catalina.sh more robust to different return values on different platforms
Patch provided by Thomas GL

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

bin/catalina.sh

index a2eb4d8..6f80cdb 100755 (executable)
@@ -354,7 +354,7 @@ elif [ "$1" = "stop" ] ; then
   SLEEP=5
   if [ ! -z "$1" ]; then
     echo $1 | grep "[^0-9]" > /dev/null 2>&1
-    if [ $? -eq 1 ]; then
+    if [ $? -gt 0 ]; then
       SLEEP=$1
       shift
     fi
@@ -369,7 +369,7 @@ elif [ "$1" = "stop" ] ; then
   if [ ! -z "$CATALINA_PID" ]; then
     if [ -f "$CATALINA_PID" ]; then
       kill -0 `cat $CATALINA_PID` >/dev/null 2>&1
-      if [ $? -eq 1 ]; then
+      if [ $? -gt 0 ]; then
         echo "PID file ($CATALINA_PID) found but no matching process was found. Stop aborted."
         exit 1
       fi
@@ -390,7 +390,7 @@ elif [ "$1" = "stop" ] ; then
     if [ -f "$CATALINA_PID" ]; then
       while [ $SLEEP -ge 0 ]; do 
         kill -0 `cat $CATALINA_PID` >/dev/null 2>&1
-        if [ $? -eq 1 ]; then
+        if [ $? -gt 0 ]; then
           rm $CATALINA_PID
           break
         fi