source: nutchez-0.1/tomcat/webapps/docs/printer/windows-service-howto.html @ 224

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

NutchEz - an easy way to nutch

File size: 20.5 KB
Line 
1<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 6.0 - Windows service HOW-TO</title><meta value="Mladen Turk" name="author"><meta value="mturk@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt="
2      The Apache Tomcat Servlet/JSP Container
3    " align="right" src="./../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="./../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat 6.0</h1><h2>Windows service HOW-TO</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="NOTICE"><strong>NOTICE</strong></a></font></td></tr><tr><td><blockquote>
4<p>
5    <b>This section of the documentation applies to procrun 1.0, and is now obsolete.</b>
6</p>
7</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Tomcat6 service application"><strong>Tomcat6 service application</strong></a></font></td></tr><tr><td><blockquote>
8<p>
9    <b>Tomcat6</b> is a service application for running Tomcat6 as NT service.
10</p>
11</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Tomcat6w monitor application"><strong>Tomcat6w monitor application</strong></a></font></td></tr><tr><td><blockquote>
12<p>
13    <b>Tomcat6w</b> is a GUI application for monitoring and configuring Tomcat
14    services.
15</p>   
16    <p>The available command line options are:</p>
17<p> 
18    <table>
19    <tr><th>//ES//</th>
20        <td>Edit service configuration</td>
21        <td>This is the default operation. It is called if the no option is
22            provided but the executable is renamed to <b>servicenameW.exe</b></td>
23    </tr>
24    <tr><th>//MS//</th>
25        <td>Monitor service</td>
26        <td>Put the icon in the system try</td>
27    </tr>
28    </table>
29</p>
30</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Command line arguments"><strong>Command line arguments</strong></a></font></td></tr><tr><td><blockquote>
31<p>
32    Each command line directive is in the form of <b>//XX//ServiceName</b>
33</p>
34    <p>The available command line options are:</p>
35<p> 
36    <table>
37    <tr><th>//TS//</th>
38        <td>Run the service as console application</td>
39        <td>This is the default operation. It is called if the no option is
40            provided. The ServiceName is the name of the executable without
41            exe sufix, meaning Tomcat6</td>
42    </tr>
43    <tr><th>//RS//</th>
44        <td>Run the service</td>
45        <td>Called only from ServiceManager</td>
46    </tr>
47    <tr><th>//SS//</th>
48        <td>Stop the service</td>
49        <td></td>
50    </tr>
51    <tr><th>//US//</th>
52        <td>Update service parameters</td>
53        <td></td>
54    </tr>
55    <tr><th>//IS//</th>
56        <td>Install service</td>
57        <td></td>
58    </tr>
59    <tr><th>//DS//</th>
60        <td>Delete service</td>
61        <td>Stops the service if running</td>
62    </tr>       
63    </table>
64</p> 
65</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Command line parameters"><strong>Command line parameters</strong></a></font></td></tr><tr><td><blockquote>
66<p>
67    Each command parameter is prefixed with <b>--</b>.
68    If the command line is prefixed with <b>++</b> then it's value will
69    be appended to the existing option.
70    If the environment variable with the same name as command line parameter but
71    prefixed with <code>PR_</code> exists it will take precedence.
72    For example:
73<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>set PR_CLASSPATH=xx.jar</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div>
74</p>   
75<p>is equivalent to providing
76<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>--Classpath=xx.jar</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div>
77</p>
78<p> as command line parameter.</p>
79<p> 
80    <table>
81    <tr>
82    <th>ParameterName</th>
83  <th>Default</th>
84  <th>Description</th>
85  </tr> 
86    <tr>
87    <td>--Description</td>
88    <td></td>
89    <td>Service name description (maximum 1024 characters)</td>
90    </tr>
91    <tr>
92    <td>--DisplayName</td>
93    <td>ServiceName</td>
94    <td>Service display name</td>
95    </tr>
96    <tr>
97    <td>--Install</td>
98    <td>procrun.exe //RS//ServiceName</td>
99    <td>Install image</td>
100    </tr>
101    <tr>
102    <td>--Startup</td>
103    <td>manual</td>
104    <td>Service startup mode can be either <b>auto</b> or <b>manual</b></td>
105    </tr>
106    <tr>
107    <td>--DependsOn</td>
108    <td></td>
109    <td>List of services that this service depend on. Dependent services
110        are separated using either <b>#</b> or <b>;</b> characters</td>
111    </tr>
112    <tr>
113    <td>--Environment</td>
114    <td></td>
115    <td>List of environment variables that will be provided to the service
116        in the form <b>key=value</b>. They are separated using either
117        <b>#</b> or <b>;</b> characters</td>
118    </tr>
119    <tr>
120    <td>--User</td>
121    <td></td>
122    <td>User account used for running executable. It is used only for
123      StartMode <b>java</b> or <b>exe</b> and enables running applications
124      as service under account without LogonAsService privilege.</td>
125    </tr>
126    <tr>
127    <td>--Password</td>
128    <td></td>
129    <td>Password for user account set by --User parameter</td>
130    </tr>
131    <tr>
132    <td>--JavaHome</td>
133    <td>JAVA_HOME</td>
134    <td>Set a different JAVA_HOME then defined by JAVA_HOME environment
135        variable</td>
136    </tr>
137    <tr>
138    <td>--Jvm</td>
139    <td>auto</td>
140    <td>Use either <b>auto</b> or specify the full path to the <b>jvm.dll</b>.
141        You can use the environment variable expansion here.</td>
142    </tr>
143    <tr>
144    <td>--JvmOptions</td>
145    <td>-Xrs</td>
146    <td>List of options in the form of <b>-D</b> or <b>-X</b> that will be
147        passed to the JVM. The options are separated using either
148        <b>#</b> or <b>;</b> characters.</td>
149    </tr>
150    <tr>
151    <td>--Classpath</td>
152    <td></td>
153    <td>Set the Java classpath</td>
154    </tr>
155    <tr>
156    <td>--JvmMs</td>
157    <td></td>
158    <td>Initial memory pool size in MB</td>
159    </tr>
160    <tr>
161    <td>--JvmMx</td>
162    <td></td>
163    <td>Maximum memory pool size in MB</td>
164    </tr>
165    <tr>
166    <td>--JvmSs</td>
167    <td></td>
168    <td>Thread stack size in KB</td>
169    </tr>
170    <tr>
171    <tr>
172    <td>--StartImage</td>
173    <td></td>
174    <td>Executable that will be run.</td>
175    </tr>
176    <tr>
177    <td>--StartPath</td>
178    <td></td>
179    <td>Working path for the start image executable.</td>
180    </tr>
181    <tr>
182    <td>--StartClass</td>
183    <td></td>
184    <td>Class that will be used for startup.</td>
185    </tr>
186    <tr>
187    <td>--StartParams</td>
188    <td></td>
189    <td>List of parameters that will be passed to either StartImage or
190        StartClass. Parameters are separated using either <b>#</b> or
191        <b>;</b> character.</td>
192    </tr>
193    <tr>
194    <td>--StartMethod</td>
195    <td>Main</td>
196    <td>Method name if differs then main</td>
197    </tr>
198    <tr>
199    <td>--StartMode</td>
200    <td>executable</td>
201    <td>Can one of <b>jvm</b> <b>java</b> or <b>exe</b></td>
202    </tr>
203    <td>--StopImage</td>
204    <td></td>
205    <td>Executable that will be run on Stop service signal.</td>
206    </tr>
207    <tr>
208    <td>--StopPath</td>
209    <td></td>
210    <td>Working path for the stop image executable.</td>
211    </tr>
212    <tr>
213    <td>--StopClass</td>
214    <td></td>
215    <td>Class that will be used on Stop service signal.</td>
216    </tr>
217    <tr>
218    <td>--StopParams</td>
219    <td></td>
220    <td>List of parameters that will be passed to either StopImage or
221        StopClass. Parameters are separated using either <b>#</b> or
222        <b>;</b> character.</td>
223    </tr>
224    <tr>
225    <td>--StopMethod</td>
226    <td>Main</td>
227    <td>Method name if differs then main</td>
228    </tr>
229    <tr>
230    <td>--StopMode</td>
231    <td>executable</td>
232    <td>Can one of <b>jvm</b> <b>java</b> or <b>exe</b></td>
233    </tr>
234    <tr>
235    <td>--StopTimeout</td>
236    <td>No Timeout</td>
237    <td>Defines the timeout in seconds that procrun waits for service to
238        exit gracefully.</td>
239    </tr>
240    <tr>
241    <td>--LogPath</td>
242    <td>working path</td>
243    <td>Defines the path for logging</td>
244    </tr>
245    <tr>
246    <td>--LogPrefix</td>
247    <td>jakarta_service</td>
248    <td>Defines the service log filename</td>
249    </tr>
250    <tr>
251    <td>--LogLevel</td>
252    <td>INFO</td>
253    <td>Defines the logging level and can be either <b>error</b>,
254        <b>info</b>, <b>warn</b> or <b>debug</b></td>
255    </tr>
256    <tr>
257    <td>--StdOutput</td>
258    <td></td>
259    <td>Redirected stdout filename</td>
260    </tr>
261    <tr>
262    <td>--StdError</td>
263    <td></td>
264    <td>Redirected stderr filename</td>
265    </tr>   
266    </table>
267</p> 
268</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Installing services"><strong>Installing services</strong></a></font></td></tr><tr><td><blockquote>
269<p>
270The safest way to manually install the service is to use the provided <b>service.bat</b> script.
271</p>
272<p>
273<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
274Install the service named 'Tomcat6'
275C:\&gt; service.bat install
276</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div>
277</p>
278<p>
279If using tomcat6.exe, you need to use the <b>//IS//</b> parameter.
280</p>
281<p>
282<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
283Install the service named 'Tomcat6'
284C:\&gt; tomcat6 //IS//Tomcat6 --DisplayName="Apache Tomcat 6" \
285C:\&gt; --Install="C:\Program Files\Tomcat\bin\tomcat6.exe" --Jvm=auto \
286C:\&gt; --StartMode=jvm --StopMode=jvm \
287C:\&gt; --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start \
288C:\&gt; --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
289</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div>
290</p>
291</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Updating services"><strong>Updating services</strong></a></font></td></tr><tr><td><blockquote>
292<p>
293To update the service parameters, you need to use the <b>//US//</b> parameter.
294</p>
295<p>
296<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
297Update the service named 'Tomcat6
298C:\&gt; tomcat6 //US//Tomcat6 --Description="Apache Tomcat Server - http://tomcat.apache.org/ " \
299C:\&gt; --Startup=auto --Classpath=%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\bin\bootstrap.jar
300</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div>
301</p>
302</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Removing services"><strong>Removing services</strong></a></font></td></tr><tr><td><blockquote>
303<p>
304To remove the service, you need to use the <b>//DS//</b> parameter.<br>
305If the service is running it will be stopped and then deleted.
306</p>
307<p>
308<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
309Remove the service named 'Tomcat6'
310C:\&gt; tomcat6 //DS//Tomcat6
311</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div>
312</p>
313</blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Debugging services"><strong>Debugging services</strong></a></font></td></tr><tr><td><blockquote>
314<p>
315To run the service in console mode, you need to use the <b>//TS//</b> parameter.
316The service shutdown can be initiated by pressing <b>CTRL+C</b> or
317<b>CTRL+BREAK</b>.
318If you rename the tomcat6.exe to testservice.exe then you can just execute the
319testservice.exe and this command mode will be executed by default.
320</p>
321<p>
322<div align="left"><table border="0" cellpadding="0" cellspacing="4"><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#ffffff"><pre>
323Run the service named 'Tomcat6' in console mode
324C:\&gt; tomcat6 //TS//Tomcat6 [additional arguments]
325Or simply execute:
326C:\&gt; tomcat6
327</pre></td><td width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr><tr><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td><td height="1" width="1" bgcolor="#023264"><img border="0" hspace="0" vspace="0" height="1" width="1" src="./../images/void.gif"></td></tr></table></div>
328</p>
329</blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em>
330        Copyright &copy; 1999-2008, Apache Software Foundation
331        </em></font></div></td></tr></table></body></html>
Note: See TracBrowser for help on using the repository browser.