|
Tomcat example source code file (windows-service-howto.xml)
The Tomcat windows-service-howto.xml source code<?xml version="1.0"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!DOCTYPE document [ <!ENTITY project SYSTEM "project.xml"> ]> <document url="windows-service-howto.html"> &project; <properties> <author email="mturk@apache.org">Mladen Turk <title>Windows service HOW-TO </properties> <body> <section name="NOTICE"> <p> <b>This section of the documentation applies to procrun 1.0, and is now obsolete. </p> </section> <section name="Tomcat6 service application"> <p> <b>Tomcat6 is a service application for running Tomcat6 as NT service. </p> </section> <section name="Tomcat6w monitor application"> <p> <b>Tomcat6w is a GUI application for monitoring and configuring Tomcat services. </p> <p>The available command line options are: <p> <table> <tr> |
<td>This is the default operation. It is called if the no option is
provided but the executable is renamed to <b>servicenameW.exe
</tr>
<tr>//MS// | <td>Monitor service <td>Put the icon in the system try </tr> </table> </p> </section> <section name="Command line arguments"> <p> Each command line directive is in the form of <b>//XX//ServiceName </p> <p>The available command line options are: <p> <table> <tr>//TS// | <td>Run the service as console application <td>This is the default operation. It is called if the no option is provided. The ServiceName is the name of the executable without exe sufix, meaning Tomcat6</td> </tr> <tr>//RS// | <td>Run the service <td>Called only from ServiceManager </tr> <tr>//SS// | <td>Stop the service <td> </tr> <tr>//US// | <td>Update service parameters <td> </tr> <tr>//IS// | <td>Install service <td> </tr> <tr>//DS// | <td>Delete service <td>Stops the service if running </tr> </table> </p> </section> <section name="Command line parameters"> <p> Each command parameter is prefixed with <b>--. If the command line is prefixed with <b>++ then it's value will be appended to the existing option. If the environment variable with the same name as command line parameter but prefixed with <code>PR_ exists it will take precedence. For example: <source>set PR_CLASSPATH=xx.jar </p> <p>is equivalent to providing <source>--Classpath=xx.jar </p> <p> as command line parameter. <p> <table> <tr> <th>ParameterName <th>Default <th>Description </tr> <tr> <td>--Description <td> <td>Service name description (maximum 1024 characters) </tr> <tr> <td>--DisplayName <td>ServiceName <td>Service display name </tr> <tr> <td>--Install <td>procrun.exe //RS//ServiceName <td>Install image </tr> <tr> <td>--Startup <td>manual <td>Service startup mode can be either auto or manual </tr> <tr> <td>--DependsOn <td> <td>List of services that this service depend on. Dependent services are separated using either <b># or ; characters </tr> <tr> <td>--Environment <td> <td>List of environment variables that will be provided to the service in the form <b>key=value. They are separated using either <b># or ; characters </tr> <tr> <td>--User <td> <td>User account used for running executable. It is used only for StartMode <b>java or exe and enables running applications as service under account without LogonAsService privilege.</td> </tr> <tr> <td>--Password <td> <td>Password for user account set by --User parameter </tr> <tr> <td>--JavaHome <td>JAVA_HOME <td>Set a different JAVA_HOME then defined by JAVA_HOME environment variable</td> </tr> <tr> <td>--Jvm <td>auto <td>Use either auto or specify the full path to the jvm.dll. You can use the environment variable expansion here.</td> </tr> <tr> <td>--JvmOptions <td>-Xrs <td>List of options in the form of -D or -X that will be passed to the JVM. The options are separated using either <b># or ; characters. </tr> <tr> <td>--Classpath <td> <td>Set the Java classpath </tr> <tr> <td>--JvmMs <td> <td>Initial memory pool size in MB </tr> <tr> <td>--JvmMx <td> <td>Maximum memory pool size in MB </tr> <tr> <td>--JvmSs <td> <td>Thread stack size in KB </tr> <tr> <tr> <td>--StartImage <td> <td>Executable that will be run. </tr> <tr> <td>--StartPath <td> <td>Working path for the start image executable. </tr> <tr> <td>--StartClass <td> <td>Class that will be used for startup. </tr> <tr> <td>--StartParams <td> <td>List of parameters that will be passed to either StartImage or StartClass. Parameters are separated using either <b># or <b>; character. </tr> <tr> <td>--StartMethod <td>Main <td>Method name if differs then main </tr> <tr> <td>--StartMode <td>executable <td>Can one of jvm java or exe </tr> <td>--StopImage <td> <td>Executable that will be run on Stop service signal. </tr> <tr> <td>--StopPath <td> <td>Working path for the stop image executable. </tr> <tr> <td>--StopClass <td> <td>Class that will be used on Stop service signal. </tr> <tr> <td>--StopParams <td> <td>List of parameters that will be passed to either StopImage or StopClass. Parameters are separated using either <b># or <b>; character. </tr> <tr> <td>--StopMethod <td>Main <td>Method name if differs then main </tr> <tr> <td>--StopMode <td>executable <td>Can one of jvm java or exe </tr> <tr> <td>--StopTimeout <td>No Timeout <td>Defines the timeout in seconds that procrun waits for service to exit gracefully.</td> </tr> <tr> <td>--LogPath <td>working path <td>Defines the path for logging </tr> <tr> <td>--LogPrefix <td>jakarta_service <td>Defines the service log filename </tr> <tr> <td>--LogLevel <td>INFO <td>Defines the logging level and can be either error, <b>info, warn or debug </tr> <tr> <td>--StdOutput <td> <td>Redirected stdout filename </tr> <tr> <td>--StdError <td> <td>Redirected stderr filename </tr> </table> </p> </section> <section name="Installing services"> <p> The safest way to manually install the service is to use the provided <b>service.bat script. </p> <p> <source> Install the service named 'Tomcat6' C:\> service.bat install </source> </p> <p> If using tomcat6.exe, you need to use the <b>//IS// parameter. </p> <p> <source> Install the service named 'Tomcat6' C:\> tomcat6 //IS//Tomcat6 --DisplayName="Apache Tomcat 6" \ C:\> --Install="C:\Program Files\Tomcat\bin\tomcat6.exe" --Jvm=auto \ C:\> --StartMode=jvm --StopMode=jvm \ C:\> --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start \ C:\> --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop </source> </p> </section> <section name="Updating services"> <p> To update the service parameters, you need to use the <b>//US// parameter. </p> <p> <source> Update the service named 'Tomcat6 C:\> tomcat6 //US//Tomcat6 --Description="Apache Tomcat Server - http://tomcat.apache.org/ " \ C:\> --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar </source> </p> </section> <section name="Removing services"> <p> To remove the service, you need to use the <b>//DS// parameter.
---|
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.