You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ha...@hyperreal.org on 1999/11/25 21:42:25 UTC

cvs commit: jakarta-tomcat/src/shell tomcat.bat tomcat.sh

harishp     99/11/25 12:42:22

  Modified:    .        build.sh
  Added:       src/shell tomcat.bat tomcat.sh
  Log:
  Added 2 new scripts. One for unix and another for windoz.
  
  Why?. startup and shutdown pretty much do the same thing..... Everytime
  there is a change in the classpath/environment etc. we would need to
  change both the scripts... Which is a drag..  "if-then-else"
  statements are for exactly this purpose.....
  
  These script are intended to replace startup and shutdown scripts.
  You can now use:
  
  ./tomcat.sh -start
  ./tomcat.sh -stop
  
  instead.
  
  I don't have a windoz machine so, I could not test the tomcat.bat
  script. It should work. Can someone verify it for me?
  
  Once everyone moves over to the new script, the intent is to remove
  startup and shutdown scripts.
  
  I have changed the build.sh to give execute permission to all shell
  script after building. I got tired to doing chmod +x startup.sh
  everytime I did a clean build.
  
  Revision  Changes    Path
  1.2       +4 -2      jakarta-tomcat/build.sh
  
  Index: build.sh
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/build.sh,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- build.sh	1999/10/09 00:19:57	1.1
  +++ build.sh	1999/11/25 20:42:10	1.2
  @@ -1,7 +1,9 @@
   #! /bin/sh
   
  -# $Id: build.sh,v 1.1 1999/10/09 00:19:57 duncan Exp $
  +# $Id: build.sh,v 1.2 1999/11/25 20:42:10 harishp Exp $
   
  -cp=../jakarta-tools/ant.jar:../jakarta-tools/projectx-tr2.jar
  +cp=../jakarta-tools/ant.jar:../jakarta-tools/projectx-tr2.jar:../build/tomcat/classes
   
   java -classpath $cp:$CLASSPATH org.apache.tools.ant.Main $*
  +
  +chmod +x `find ../build -name "*.sh"`
  
  
  
  1.1                  jakarta-tomcat/src/shell/tomcat.bat
  
  Index: tomcat.bat
  ===================================================================
  @echo off
  rem $Id: tomcat.bat,v 1.1 1999/11/25 20:42:20 harishp Exp $
  rem A batch file to start/stop tomcat server.
  
  rem This batch file written and tested under Windows NT
  rem Improvements to this file are welcome
  
  set jsdkJars=.\webserver.jar;.\lib\servlet.jar
  set jspJars=.\lib\jasper.jar
  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
  
  set appClassPath=.\classes;%appJars%
  set cp=%CLASSPATH%
  
  set CLASSPATH=%appClassPath%;%sysJars%
  
  if "%cp%" == "" goto next
  
  rem else 
  set CLASSPATH=%CLASSPATH%;%cp% 
   
  :next
  if "%1" == "-start" goto startServer
  if "%1" == "-stop" goto stopServer
  @echo on
  @echo Usage:
  @echo tomcat [-start|-stop]
  @echo off
  goto cleanup
  
  :startServer
  rem Start the Tomcat Server
  @echo on
  @echo Using classpath: %CLASSPATH%
  @echo off
  start java org.apache.tomcat.shell.Startup %2 %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :stopServer
  rem Stop the Tomcat Server
  @echo on
  @echo Using classpath: %CLASSPATH%
  @echo off
  java org.apache.tomcat.shell.Shutdown %2 %3 %4 %5 %6 %7 %8 %9
  goto cleanup
  
  :cleanup
  rem clean up
  
  set CLASSPATH=%cp%
  set port=
  set host=
  set test=
  set jsdkJars=
  set jspJars=
  set beanJars=
  set miscJars=
  set appJars=
  set appClassPath=
  set cp=
  
  rem pause
  
  
  
  1.1                  jakarta-tomcat/src/shell/tomcat.sh
  
  Index: tomcat.sh
  ===================================================================
  #!/bin/sh
  #
  # $Id: tomcat.sh,v 1.1 1999/11/25 20:42:21 harishp Exp $
  
  # Shell script to start and stop the server
  
  # There are other, simpler commands to startup the runner. The two
  # commented commands good replacements. The first works well with
  # Java Platform 1.1 based runtimes. The second works well with
  # Java2 Platform based runtimes.
  
  #jre -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Startup $*
  #java -cp runner.jar:servlet.jar:classes org.apache.tomcat.shell.Startup $*
  
  baseDir=`dirname $0`
  
  jsdkJars=${baseDir}/webserver.jar:${baseDir}/lib/servlet.jar
  jspJars=${baseDir}/lib/jasper.jar
  beanJars=${baseDir}/webpages/WEB-INF/classes/jsp/beans
  miscJars=${baseDir}/lib/xml.jar
  appJars=${jsdkJars}:${jspJars}:${beanJars}:${miscJars}
  sysJars=${JAVA_HOME}/lib/tools.jar
  
  appClassPath=${appJars}
  cp=$CLASSPATH
  
  # Backdoor classpath setting for development purposes when all classes
  # are compiled into a /classes dir and are not yet jarred.
  
  if [ -d ${baseDir}/classes ]; then
      appClassPath=${baseDir}/classes:${appClassPath}
  fi
  
  CLASSPATH=${appClassPath}:${sysJars}
  export CLASSPATH
  
  if [ "$cp" != "" ]; then
      CLASSPATH=${CLASSPATH}:${cp}
      export CLASSPATH
  fi
  
  
  # We start the server up in the background for a couple of reasons:
  #   1) It frees up your command window
  #   2) You should use `-stop` option instead of ^C to bring down the server
  
  if test "$1" = "-start" 
  then 
  shift 
  echo Using classpath: ${CLASSPATH}
  java org.apache.tomcat.shell.Startup $* &
  elif test "$1" = "-stop"
  then 
  shift 
  echo Using classpath: ${CLASSPATH}
  java org.apache.tomcat.shell.Shutdown $*
  else
  echo "Usage:"
  echo "tomcat [-start|-stop]"
  exit 0
  fi
  
  
  if [ "$cp" != "" ]; then
      CLASSPATH=${cp}
      export CLASSPATH
  else
      unset CLASSPATH
  fi
  
  
  

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

Posted by Harish Prabandham <Ha...@eng.sun.com>.
James Duncan Davidson wrote:

> "Craig R. McClanahan" wrote:
> > I like the idea of a combined startup/shutdown script, but I would also suggest that we
> > consider using "start" and "stop" as the arguments, rather than "-start" and "-stop".  The
> > reasoning is that this is the standard convention on many Unix platforms for system scripts
> > that go in /etc/init.d or /etc/rc.d/init.d.  If a Tomcat-based application is installed on
> > such a system, this makes integration of the startup/shutdown script easier.
>
> +1

My +1 too.

BTW, the change it in.


Harish

>
>
> --
> James Davidson                                     duncan@eng.sun.com
> Java + XML / Portable Code + Portable Data                 !try; do()
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


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

Posted by James Duncan Davidson <ja...@eng.sun.com>.
"Craig R. McClanahan" wrote:
> I like the idea of a combined startup/shutdown script, but I would also suggest that we
> consider using "start" and "stop" as the arguments, rather than "-start" and "-stop".  The
> reasoning is that this is the standard convention on many Unix platforms for system scripts
> that go in /etc/init.d or /etc/rc.d/init.d.  If a Tomcat-based application is installed on
> such a system, this makes integration of the startup/shutdown script easier.

+1

-- 
James Davidson                                     duncan@eng.sun.com 
Java + XML / Portable Code + Portable Data                 !try; do()



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

Posted by Guan Yang <gu...@softhome.net>.
It would also be useful to have a "restart" option.

Harish Prabandham wrote:
> 
> >
> > >
> > >   ./tomcat.sh -start
> > >   ./tomcat.sh -stop
> > >
> >
> > I like the idea of a combined startup/shutdown script, but I would also suggest that we
> > consider using "start" and "stop" as the arguments, rather than "-start" and "-stop".  The
> > reasoning is that this is the standard convention on many Unix platforms for system scripts
> > that go in /etc/init.d or /etc/rc.d/init.d.  If a Tomcat-based application is installed on
> > such a system, this makes integration of the startup/shutdown script easier.
> >
> > Craig McClanahan
> >
> 
> Sounds good. I will make this change.
> 
> Thanx
> 
> Harish
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

-- 
        "What time is it?"
        "I don't know, it keeps changing."

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

Posted by Harish Prabandham <Ha...@eng.sun.com>.
>
> >
> >   ./tomcat.sh -start
> >   ./tomcat.sh -stop
> >
>
> I like the idea of a combined startup/shutdown script, but I would also suggest that we
> consider using "start" and "stop" as the arguments, rather than "-start" and "-stop".  The
> reasoning is that this is the standard convention on many Unix platforms for system scripts
> that go in /etc/init.d or /etc/rc.d/init.d.  If a Tomcat-based application is installed on
> such a system, this makes integration of the startup/shutdown script easier.
>
> Craig McClanahan
>

Sounds good. I will make this change.


Thanx


Harish


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

Posted by "Craig R. McClanahan" <cm...@mytownnet.com>.
harishp@hyperreal.org wrote:

> harishp     99/11/25 12:42:22
>
>   Modified:    .        build.sh
>   Added:       src/shell tomcat.bat tomcat.sh
>   Log:
>   Added 2 new scripts. One for unix and another for windoz.
>
>   Why?. startup and shutdown pretty much do the same thing..... Everytime
>   there is a change in the classpath/environment etc. we would need to
>   change both the scripts... Which is a drag..  "if-then-else"
>   statements are for exactly this purpose.....
>
>   These script are intended to replace startup and shutdown scripts.
>   You can now use:
>
>   ./tomcat.sh -start
>   ./tomcat.sh -stop
>

I like the idea of a combined startup/shutdown script, but I would also suggest that we
consider using "start" and "stop" as the arguments, rather than "-start" and "-stop".  The
reasoning is that this is the standard convention on many Unix platforms for system scripts
that go in /etc/init.d or /etc/rc.d/init.d.  If a Tomcat-based application is installed on
such a system, this makes integration of the startup/shutdown script easier.

Craig McClanahan