You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2003/12/22 14:48:52 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/bin service.bat

mturk       2003/12/22 05:48:52

  Added:       catalina/src/bin service.bat
  Log:
  Add service.bat for NT service installation/uninstallation.
  It will einter install service using default name Tomcat5 or
  uninstall.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat-catalina/catalina/src/bin/service.bat
  
  Index: service.bat
  ===================================================================
  @echo off
  if "%OS%" == "Windows_NT" setlocal
  rem ---------------------------------------------------------------------------
  rem NT Service Install/Uninstall script
  rem
  rem Options
  rem install                Install the service using Tomcat5 as service name.
  rem                        Service is installed using default settings.
  rem remove                 Remove the service from the System.
  rem
  rem name        (optional) If the second argument is present it is considered
  rem                        to be new service name                                           
  rem
  rem $Id: service.bat,v 1.1 2003/12/22 13:48:52 mturk Exp $
  rem ---------------------------------------------------------------------------
  
  rem Guess CATALINA_HOME if not defined
  set CURRENT_DIR=%cd%
  if not "%CATALINA_HOME%" == "" goto gotHome
  set CATALINA_HOME=%cd%
  if exist "%CATALINA_HOME%\bin\tomcat.exe" goto okHome
  rem CD to the upper dir
  cd ..
  set CATALINA_HOME=%cd%
  :gotHome
  if exist "%CATALINA_HOME%\bin\tomcat.exe" goto okHome
  echo The tomcat.exe was not found...
  echo The CATALINA_HOME environment variable is not defined correctly.
  echo This environment variable is needed to run this program
  goto end
  :okHome
  
  set EXECUTABLE=%CATALINA_HOME%\bin\tomcat.exe
  
  rem Set default Service name
  set SERVICE_NAME=Tomcat5
  
  if "%1" == "" goto displayUsage
  if "%2" == "" goto setServiceName
  set SERVICE_NAME=%2
  :setServiceName
  if %1 == install goto doInstall
  if %1 == remove goto doRemove
  echo Unknown parameter "%1"
  :displayUsage
  echo 
  echo Usage: service.bat install/remove [service_name]
  goto end
  
  :doRemove
  rem Remove the service
  %EXECUTABLE% //DS//%SERVICE_NAME%
  echo The service '%SERVICE_NAME%' has been removed
  goto end
  
  :doInstall
  rem Install the service
  %EXECUTABLE% //IS//%SERVICE_NAME% --DisplayName "Apache Tomcat" --Description "Apache Tomcat Server - http://jakarta.apache.org/tomcat/"  --Install "%EXECUTABLE%" --ImagePath "%CATALINA_HOME%\bootstrap.jar" --StartupClass org.apache.catalina.startup.Bootstrap;main;start --ShutdownClass org.apache.catalina.startup.Bootstrap;main;stop --Java java --Startup manual
  rem Set extra parameters
  %EXECUTABLE% //US//%SERVICE_NAME% --JavaOptions -Dcatalina.home="\"%CATALINA_HOME%\""#-Djava.endorsed.dirs="\"%CATALINA_HOME%\common\endorsed\""#-Xrs --StdOutputFile "%CATALINA_HOME%\logs\stdout.log" --StdErrorFile "%CATALINA_HOME%\logs\stderr.log" --WorkingPath "%CATALINA_HOME%\bin"
  echo The service '%SERVICE_NAME%' has been installed
  
  :end
  cd %CURRENT_DIR%
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org