Window
Because of the habit of directly decompressing, and then copying the entire tomcat to the server, it is necessary to manually install Tomcat as a Windows service;
Use the following script to implement:
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 is new service name
Rem
REM $Id: service.bat,v 1.5 2004/04/08 16:49:37 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\tomcat5.exe" goto okhome
REM CD to the Upper Dir
Cd..
Set catalina_home=%cd%
: Gothome
If exist "%catalina_home%\bin\tomcat5.exe" goto okhome
echo the tomcat.exe is not found ...
The echo the CATALINA_HOME environment variable is not defined correctly.
echo this environment variable be needed to run this program
Goto END
: Okhome
If not "%catalina_base%" = "" Goto gotbase
Set catalina_base=%catalina_home%
: Gotbase
Set Executable=%catalina_home%\bin\tomcat5.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"
:d Isplayusage
Echo
echo Usage:service.bat Install/remove [service_name]
Goto END
:d Oremove
REM Remove the Service
"%executable%"//ds//%service_name%
echo the service '%service_name% ' has been removed
Goto END
:d Oinstall
REM Install the Service
REM Use the environment variables as a exaple
rem each command line option are prefixed with pr_
Set Pr_displayname=apache Tomcat
Set Pr_description=apache Tomcat server–Http://jakarta.apache.org/tomcat
Set pr_install=%executable%
Set Pr_logpath=%catalina_home%\logs
Set Pr_classpath=%catalina_home%\bin\bootstrap.jar
"%executable%"//is//%service_name%--JVM%java_home%\jre\bin\server\jvm.dll--startclass Org.apache.catalina.startup.Bootstrap--stopclass org.apache.catalina.startup.Bootstrap--startparams Start-- Stopparams Stop--stopmode JVM--startmode JVM
REM Clear the environment variables. They are not needed any more.
Set Pr_displayname=
Set pr_description=
Set pr_install=
Set pr_logpath=
Set pr_classpath=
REM More Extra parameters
Set Pr_stdoutput=%catalina_home%\logs\stdout.log
Set Pr_stderror=%catalina_home%\logs\stderr.log
"%executable%"//us//%service_name%--jvmoptions "-djava.io.tmpdir=%catalina_base%\;-dcatalina.home=%catalina_ base%\;-djava.endorsed.dirs=%catalina_base%\common\endorsed\; "
echo the service '%service_name% ' has been installed
: End
CD%current_dir%
In the 5.0.* test pass