RE: [PATCH][3.3] tomcat.sh cleanup

2001-10-21 Thread Keith Wannamaker

It would be nice also to display the command that is used
to initialize the jk web config files, jkconf or whatever.
Keith

| -Original Message-
| From: Jeff Turner [mailto:[EMAIL PROTECTED]]
| Sent: Sunday, October 21, 2001 2:44 AM
| To: [EMAIL PROTECTED]
| Subject: [PATCH][3.3] tomcat.sh cleanup
| 
| 
| 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
| 



Re: [PATCH][3.3] tomcat.sh cleanup

2001-10-21 Thread Jeff Turner

On Sun, Oct 21, 2001 at 08:06:06AM -0400, Keith Wannamaker wrote:
 It would be nice also to display the command that is used
 to initialize the jk web config files, jkconf or whatever.

Oh yes.. you get that help currently if you type './tomcat.sh start -help'.

Rather than try to duplicate that, the attached revised patch adds 2 more
lines:

echo   start -help  -   more options
echo   start -help  -   more options


enableAdmin ought also to have -help, but it's currently broken.

--Jeff

 Keith


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 13:01:24
@@ -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
@@ -161,6 +162,7 @@
 echo Using classpath: ${CLASSPATH}
 echo Using JAVA_HOME: ${JAVA_HOME}
 echo Using TOMCAT_HOME: ${TOMCAT_HOME}
+echo $JAVACMD $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME}  $MAIN start $@ 
 $JAVACMD $TOMCAT_OPTS -Dtomcat.home=${TOMCAT_HOME}  $MAIN start $@ 
   fi
 
@@ -175,8 +177,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 +225,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 +268,23 @@
 
 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   start -help  -   more options
+  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   start -help  -   more options
+  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 

Re: [PATCH][3.3] tomcat.sh cleanup

2001-10-21 Thread Jeff Turner

On Sun, Oct 21, 2001 at 11:16:31PM +1000, Jeff Turner wrote:
 On Sun, Oct 21, 2001 at 08:06:06AM -0400, Keith Wannamaker wrote:
  It would be nice also to display the command that is used
  to initialize the jk web config files, jkconf or whatever.
 
 Oh yes.. you get that help currently if you type './tomcat.sh start -help'.
 
 Rather than try to duplicate that, the attached revised patch adds 2 more
 lines:
 
 echo   start -help  -   more options
 echo   start -help  -   more options

Feh.. that's as nonsensical as it sounds. Fixed patch attached. Extra entries:

  start -help  -   more options
 (config, debug, estart, home, install, jkconf, sandbox)
  
  stop -help   -   more options
 (ajpid, host, home, pass, port)


--Jeff

 enableAdmin ought also to have -help, but it's currently broken.
 
 --Jeff
 
  Keith



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 14:05:44
@@ -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 not 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,25 @@
 
 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   start -help  -   more options
+  echo  (config, debug, estart, home, install, jkconf, 
+sandbox)
+  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   stop -help   -   more options
+  echo  (ajpid, host, home, pass, port)
+  echo   enableAdmin  - Trust the admin web application,
+  echo  i.e.