Hi,

The help text displayed when you type "./tomcat.sh" currently reads:

Usage:
tomcat (start|env|run|stop|jspc)
        start - start tomcat in the background
        run   - start tomcat in the foreground
        run -wait - wait until tomcat is initialized before returning  
            -security - use a SecurityManager when starting
        stop  - stop tomcat
        env  -  set CLASSPATH and TOMCAT_HOME env. variables
        jspc - run jsp pre compiler


This is out of date (missing 'enableAdmin' and 'estart'), is partially
incorrect (-wait applies to 'start', not 'run'), and is hard to read.

The attached patch fixes this, so it will print:

./tomcat.sh (start|run|stop|enableAdmin|estart|env|jspc)
  start            - start tomcat in the background
  start -security  -   use a SecurityManager when starting
  start -noout     -   redirect stdout/stderr to $TOMCAT_HOME/logs/stdout.log
  start -wait      -   wait until tomcat is initialized before returning
  run              - start tomcat in the foreground
  run -security    -   use a SecurityManager when starting
  stop             - stop tomcat
  stop -force      - stop tomcat with the 'kill' command if necessary
  enableAdmin      - Trust the admin web application,
                     i.e. rewrites conf/apps-admin.xml with trusted="true"
  estart           - Start Tomcat using the/your EmbededTomcat class which
                     uses a hardcoded set of modules
  env              - set CLASSPATH and TOMCAT_HOME env. variables
  jspc             - run jsp pre compiler


The patch also fixes indentation, and parametrizes the MAX_WAIT variable to
reliably fix another doc bug.


Also, I noticed that line 294 contains:

TOMCAT_OPTS="$TOMCAT_OPTS -Djava.security.policy==${TOMCAT_HOME}/conf/tomcat.policy "

Shouldn't that be a single '='? There is the same thing in tomcat.bat. Not
being sure of the implications, I haven't changed this in the patch.


--Jeff
Index: src/shell/tomcat.sh
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/shell/tomcat.sh,v
retrieving revision 1.30
diff -u -r1.30 tomcat.sh
--- src/shell/tomcat.sh 2001/09/20 03:35:41     1.30
+++ src/shell/tomcat.sh 2001/10/21 06:23:31
@@ -32,9 +32,9 @@
     ls=`ls -ld "$PRG"`
     link=`expr "$ls" : '.*-> \(.*\)$'`
     if expr "$link" : '.*/.*' > /dev/null; then
-       PRG="$link"
+        PRG="$link"
     else
-       PRG="`dirname $PRG`/$link"
+        PRG="`dirname $PRG`/$link"
     fi
   done
   
@@ -43,10 +43,10 @@
     echo "Guessing TOMCAT_INSTALL from tomcat.sh to ${TOMCAT_INSTALL_1}" 
   fi
     if [ -d ${TOMCAT_INSTALL_1}/lib ] ; then 
-       TOMCAT_INSTALL=${TOMCAT_INSTALL_1}
+        TOMCAT_INSTALL=${TOMCAT_INSTALL_1}
         if [ "$DEBUG_HOMEFIND" != "false" ] ; then
           echo "Setting TOMCAT_INSTALL to $TOMCAT_INSTALL"
-       fi
+        fi
     fi
 fi
 
@@ -85,11 +85,11 @@
 
 if [ "$TOMCAT_HOME" = "" ] ; then
     if [ -d ./conf ] ; then 
-       TOMCAT_HOME=.
+        TOMCAT_HOME=.
     elif [ -d ../conf ] ; then 
-       TOMCAT_HOME=..
+        TOMCAT_HOME=..
     else
-       TOMCAT_HOME=$TOMCAT_INSTALL
+        TOMCAT_HOME=$TOMCAT_INSTALL
     fi
 fi
 
@@ -147,11 +147,12 @@
         rm -f  ${TOMCAT_HOME}/conf/ajp12.id
   fi
 
+  MAX_WAIT=360
   WAIT=0
   if [ "$1" = "-wait" ] ; then
     shift
     # wait at least 6 min 
-    WAIT=360
+    WAIT=${MAX_WAIT}
   fi
     
   if [ "$1" = "-noout" ] ; then
@@ -175,8 +176,8 @@
 
         WAIT=`expr $WAIT - 1`
         if [ "$WAIT" = "0" ] ; then
-            echo "Tomcat was no ready after 120 seconds, giving up waiting "
-           break;
+            echo "Tomcat was no ready after ${MAX_WAIT} seconds, giving up waiting "
+            break;
         fi
     done
   fi
@@ -223,17 +224,17 @@
     shift 
     CLASSPATH=.
     for i in ${TOMCAT_HOME}/lib/container/* ${TOMCAT_HOME}/lib/common/* ; do
-       CLASSPATH=${CLASSPATH}:$i
+        CLASSPATH=${CLASSPATH}:$i
     done
     CLASSPATH=${CLASSPATH}:${JAVA_HOME}/lib/tools.jar
     # Backdoor classpath setting for development purposes when all classes
-       # are compiled into a /classes dir and are not yet jarred.
+    # are compiled into a /classes dir and are not yet jarred.
     if [ -d ${TOMCAT_HOME}/classes ]; then
-           CLASSPATH=${TOMCAT_HOME}/classes:${CLASSPATH}
+        CLASSPATH=${TOMCAT_HOME}/classes:${CLASSPATH}
     fi
     
     if [ "$oldCP" != "" ]; then
-       CLASSPATH=${CLASSPATH}:${oldCP}
+        CLASSPATH=${CLASSPATH}:${oldCP}
     fi
     (cd $TOMCAT_HOME; $JAVACMD $JSPC_OPTS -Dtomcat.home=${TOMCAT_HOME} 
org.apache.jasper.JspC $@ )
 
@@ -266,15 +267,21 @@
 
 else
   echo "Usage:"
-  echo "tomcat (start|env|run|stop|jspc)"
-  echo "        start - start tomcat in the background"
-  echo "        run   - start tomcat in the foreground"
-  echo "        run -wait - wait until tomcat is initialized before returning  "
-  echo "            -security - use a SecurityManager when starting"
-  echo "        stop  - stop tomcat"
-  echo "        env  -  set CLASSPATH and TOMCAT_HOME env. variables"
-  echo "        jspc - run jsp pre compiler"
-
+  echo "$0 (start|run|stop|enableAdmin|estart|env|jspc)"
+  echo "  start            - start tomcat in the background"
+  echo "  start -security  -   use a SecurityManager when starting"
+  echo "  start -noout     -   redirect stdout/stderr to 
+\$TOMCAT_HOME/logs/stdout.log"
+  echo "  start -wait      -   wait until tomcat is initialized before returning"
+  echo "  run              - start tomcat in the foreground"
+  echo "  run -security    -   use a SecurityManager when starting"
+  echo "  stop             - stop tomcat"
+  echo "  stop -force      - stop tomcat with the 'kill' command if necessary"
+  echo "  enableAdmin      - Trust the admin web application,"
+  echo "                     i.e. rewrites conf/apps-admin.xml with trusted=\"true\""
+  echo "  estart           - Start Tomcat using the/your EmbededTomcat class which"
+  echo "                     uses a hardcoded set of modules"
+  echo "  env              - set CLASSPATH and TOMCAT_HOME env. variables"
+  echo "  jspc             - run jsp pre compiler"
   exit 0
 fi
 

Reply via email to