source: nutchez-0.1/tomcat/bin/service.bat @ 73

Last change on this file since 73 was 66, checked in by waue, 15 years ago

NutchEz - an easy way to nutch

File size: 4.8 KB
Line 
1@echo off
2rem Licensed to the Apache Software Foundation (ASF) under one or more
3rem contributor license agreements.  See the NOTICE file distributed with
4rem this work for additional information regarding copyright ownership.
5rem The ASF licenses this file to You under the Apache License, Version 2.0
6rem (the "License"); you may not use this file except in compliance with
7rem the License.  You may obtain a copy of the License at
8rem
9rem     http://www.apache.org/licenses/LICENSE-2.0
10rem
11rem Unless required by applicable law or agreed to in writing, software
12rem distributed under the License is distributed on an "AS IS" BASIS,
13rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14rem See the License for the specific language governing permissions and
15rem limitations under the License.
16
17if "%OS%" == "Windows_NT" setlocal
18rem ---------------------------------------------------------------------------
19rem NT Service Install/Uninstall script
20rem
21rem Options
22rem install                Install the service using Tomcat6 as service name.
23rem                        Service is installed using default settings.
24rem remove                 Remove the service from the System.
25rem
26rem name        (optional) If the second argument is present it is considered
27rem                        to be new service name                                           
28rem
29rem $Id: service.bat 600659 2007-12-03 20:15:09Z jim $
30rem ---------------------------------------------------------------------------
31
32rem Guess CATALINA_HOME if not defined
33set CURRENT_DIR=%cd%
34if not "%CATALINA_HOME%" == "" goto gotHome
35set CATALINA_HOME=%cd%
36if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome
37rem CD to the upper dir
38cd ..
39set CATALINA_HOME=%cd%
40:gotHome
41if exist "%CATALINA_HOME%\bin\tomcat6.exe" goto okHome
42echo The tomcat.exe was not found...
43echo The CATALINA_HOME environment variable is not defined correctly.
44echo This environment variable is needed to run this program
45goto end
46rem Make sure prerequisite environment variables are set
47if not "%JAVA_HOME%" == "" goto okHome
48echo The JAVA_HOME environment variable is not defined
49echo This environment variable is needed to run this program
50goto end 
51:okHome
52if not "%CATALINA_BASE%" == "" goto gotBase
53set CATALINA_BASE=%CATALINA_HOME%
54:gotBase
55 
56set EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe
57
58rem Set default Service name
59set SERVICE_NAME=Tomcat6
60set PR_DISPLAYNAME=Apache Tomcat
61
62if "%1" == "" goto displayUsage
63if "%2" == "" goto setServiceName
64set SERVICE_NAME=%2
65set PR_DISPLAYNAME=Apache Tomcat %2
66:setServiceName
67if %1 == install goto doInstall
68if %1 == remove goto doRemove
69if %1 == uninstall goto doRemove
70echo Unknown parameter "%1"
71:displayUsage
72echo.
73echo Usage: service.bat install/remove [service_name]
74goto end
75
76:doRemove
77rem Remove the service
78"%EXECUTABLE%" //DS//%SERVICE_NAME%
79echo The service '%SERVICE_NAME%' has been removed
80goto end
81
82:doInstall
83rem Install the service
84echo Installing the service '%SERVICE_NAME%' ...
85echo Using CATALINA_HOME:    %CATALINA_HOME%
86echo Using CATALINA_BASE:    %CATALINA_BASE%
87echo Using JAVA_HOME:        %JAVA_HOME%
88
89rem Use the environment variables as an example
90rem Each command line option is prefixed with PR_
91
92set PR_DESCRIPTION=Apache Tomcat Server - http://tomcat.apache.org/
93set PR_INSTALL=%EXECUTABLE%
94set PR_LOGPATH=%CATALINA_BASE%\logs
95set PR_CLASSPATH=%CATALINA_HOME%\bin\bootstrap.jar
96rem Set the server jvm from JAVA_HOME
97set PR_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll
98if exist "%PR_JVM%" goto foundJvm
99rem Set the client jvm from JAVA_HOME
100set PR_JVM=%JAVA_HOME%\jre\bin\client\jvm.dll
101if exist "%PR_JVM%" goto foundJvm
102set PR_JVM=auto
103:foundJvm
104echo Using JVM:              %PR_JVM%
105"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.catalina.startup.Bootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop
106if not errorlevel 1 goto installed
107echo Failed installing '%SERVICE_NAME%' service
108goto end
109:installed
110rem Clear the environment variables. They are not needed any more.
111set PR_DISPLAYNAME=
112set PR_DESCRIPTION=
113set PR_INSTALL=
114set PR_LOGPATH=
115set PR_CLASSPATH=
116set PR_JVM=
117rem Set extra parameters
118"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm
119rem More extra parameters
120set PR_LOGPATH=%CATALINA_BASE%\logs
121set PR_STDOUTPUT=auto
122set PR_STDERROR=auto
123"%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties" --JvmMs 128 --JvmMx 256
124echo The service '%SERVICE_NAME%' has been installed.
125
126:end
127cd %CURRENT_DIR%
Note: See TracBrowser for help on using the repository browser.