You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@costin.dnt.ro on 2000/01/12 08:59:39 UTC

Re: cvs commit: jakarta-tomcat/src/shell startup.bat tomcat.bat

>   Add -nospawn option on Win32 platforms
>   Submitted by: Conor MacNeill <co...@m64.com>

The shell script uses "tomcat run" command for nospawn
( similar with tomcat start, stop )

Another usefull  option is "tomcat env" - that will set your 
environment but without running tomcat. ( usefull if you want to
compile something) ( use it with ". tomcat env" or "source tomcat env")

It would be nice to use the same names, and "nospawn" doesn't seems right
- it still does spawn :-)

Costin



[PATCH] updated after comments ( RE: cvs commit: jakarta-tomcat/src/shell startup.bat tomcat.bat)

Posted by Conor MacNeill <co...@m64.com>.
Costin,

Thanks for the feedback on my patch

>
>
> >   Add -nospawn option on Win32 platforms
> >   Submitted by: Conor MacNeill <co...@m64.com>
>
> The shell script uses "tomcat run" command for nospawn
> ( similar with tomcat start, stop )

I had quickly checked the usage under Unix and it didn't mention these
options :-). I agree that  we should have the same names and the same
(similar) behaviour

>
> Another usefull  option is "tomcat env" - that will set your
> environment but without running tomcat. ( usefull if you want to
> compile something) ( use it with ". tomcat env" or "source tomcat env")
>
> It would be nice to use the same names, and "nospawn" doesn't seems right
> - it still does spawn :-)
>

It doesn't spawn a new cmd.exe process (along with its window). I gave it
the flick anyway :-)

> Costin
>

Here is a patch to several of the startup files. This patch changes
tomcat.bat back to its previous strategy and adds the new "run" and "env"
options. I also updated the usage statements for both tomcat.bat and
tomcat.sh to include the run option and provide info on what each option
does. The info is pretty obvious but it doesn't hurt to spell things out. I
didn't include any info on the env option as its more a developer level
option IMHO.

I considered using javaw in the start option under windows to avoid the
output window altogether. Probably should wait until there is a better
logging story. What do you think?

Index: startup.bat
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/shell/startup.bat,v
retrieving revision 1.3
diff -u -r1.3 startup.bat
--- startup.bat 2000/01/12 13:55:03     1.3
+++ startup.bat 2000/01/13 13:12:43
@@ -5,11 +5,5 @@
 rem This batch file written and tested under Windows NT
 rem Improvements to this file are welcome

-set arg=start
-if not "%1" == "-nospawn" goto noSpawnControl
-set arg=-nospawn start
-shift
-:noSpawnControl
-
-call tomcat %arg% %1 %2 %3 %4 %5 %6 %7 %8 %9
+call tomcat start %1 %2 %3 %4 %5 %6 %7 %8 %9
 rem pause
Index: tomcat.bat
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/shell/tomcat.bat,v
retrieving revision 1.6
diff -u -r1.6 tomcat.bat
--- tomcat.bat  2000/01/12 13:55:03     1.6
+++ tomcat.bat  2000/01/13 13:12:43
@@ -5,11 +5,9 @@
 rem This batch file written and tested under Windows NT
 rem Improvements to this file are welcome

-set spawnCommand=start
-
 set jsdkJars=.\webserver.jar;.\lib\servlet.jar
 set jspJars=.\lib\jasper.jar
-set beanJars=.\webpages\WEB-INF\classes\jsp\beans;
+set beanJars=.\webpages\WEB-INF\classes\jsp\beans
 set miscJars=.\lib\xml.jar
 set appJars=%jsdkJars%;%jspJars%;%beanJars%;%miscJars%
 set sysJars=%JAVA_HOME%\lib\tools.jar
@@ -25,27 +23,39 @@
 set CLASSPATH=%CLASSPATH%;%cp%

 :next
-if not "%1" == "-nospawn" goto noSpawnControl
-set spawnCommand=
-shift
-
-:noSpawnControl
 if "%1" == "start" goto startServer
 if "%1" == "stop" goto stopServer
+if "%1" == "run" goto runServer
+if "%1" == "env" goto setupEnv
+
 echo Usage:
-echo "tomcat [-nospawn] (start|stop)"
+echo "tomcat (start|run|stop)"
+echo "        start - start tomcat in a separate window"
+echo "        run   - start tomcat in the current window"
+echo "        stop  - stop tomcat"
 goto cleanup

 :startServer
 rem Start the Tomcat Server
+echo Starting tomcat in new window
+echo Using classpath: %CLASSPATH%
+start java org.apache.tomcat.shell.Startup %2 %3 %4 %5 %6 %7 %8 %9
+goto cleanup
+
+:runServer
+rem Start the Tomcat Server
 echo Using classpath: %CLASSPATH%
-%spawnCommand% java org.apache.tomcat.shell.Startup %2 %3 %4 %5 %6 %7 %8 %9
+java org.apache.tomcat.shell.Startup %2 %3 %4 %5 %6 %7 %8 %9
 goto cleanup

 :stopServer
 rem Stop the Tomcat Server
 echo Using classpath: %CLASSPATH%
 java org.apache.tomcat.shell.Shutdown %2 %3 %4 %5 %6 %7 %8 %9
+goto cleanup
+
+:setupEnv
+set cp=%CLASSPATH%
 goto cleanup

 :cleanup
Index: tomcat.sh
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/shell/tomcat.sh,v
retrieving revision 1.5
diff -u -r1.5 tomcat.sh
--- tomcat.sh   1999/12/15 22:53:25     1.5
+++ tomcat.sh   2000/01/13 13:12:44
@@ -120,7 +120,10 @@

 else
   echo "Usage:"
-  echo "tomcat [start|stop]"
+  echo "tomcat (start|run|stop)"
+  echo "        start - start tomcat in the background"
+  echo "        run   - start tomcat in the foreground"
+  echo "        stop  - stop tomcat"
   exit 0
 fi