tomcat注册成windows服务

在windows系统中tomcat服务的注册和删除,可以运用%TOMCAT_HOME%\bin\service.bat 来完成。

注意:目前免安装版的发布已经区分平台了(Tomcat6.0.24开始和 Tomcat7),需要下载windows平台对应的压缩包,否则在bin目录下没有:service.bat、tomcatX.exe、tomcatXw.exe 等文件。

注册服务:

删除服务:

也可以通过bin\tomcat6.exe 来对服务的注册和删除:

tomcat6w.exe的命令可选参数:

//ES// Edit service configuration This is the default operation. It is called if the no option is provided but the executable is renamed to servicenameW.exe
//MS// Monitor service Put the icon in the system try

Command line arguments:

//TS// Run the service as console application This is the default operation. It is called if the no option is provided. The ServiceName is the name of the executable without exe suffix, meaning Tomcat6
//RS// Run the service Called only from ServiceManager
//SS// Stop the service
//US// Update service parameters
//IS// Install service
//DS// Delete service Stops the service if running

Command line parameters:

ParameterName Default Description
–Description Service name description (maximum 1024 characters)
–DisplayName ServiceName Service display name
–Install procrun.exe //RS//ServiceName Install image
–Startup manual Service startup mode can be either auto or manual
–DependsOn List of services that this service depend on. Dependent services are separated using either # or ; characters
–Environment List of environment variables that will be provided to the service in the form key=value. They are separated using either # or ; characters
–User User account used for running executable. It is used only for StartMode java or exe and enables running applications as service under account without LogonAsService privilege.
–Password Password for user account set by –User parameter
–JavaHome JAVA_HOME Set a different JAVA_HOME than defined by JAVA_HOME environment variable
–Jvm auto Use either auto or specify the full path to the jvm.dll. You can use the environment variable expansion here.
–JvmOptions -Xrs List of options in the form of -D or -X that will be passed to the JVM. The options are separated using either # or ; characters.
–Classpath Set the Java classpath
–JvmMs Initial memory pool size in MB
–JvmMx Maximum memory pool size in MB
–JvmSs Thread stack size in KB
–StartImage Executable that will be run.
–StartPath Working path for the start image executable.
–StartClass Class that will be used for startup.
–StartParams List of parameters that will be passed to either StartImage or StartClass. Parameters are separated using either # or ; character.
–StartMethod Main Method name if differs then main
–StartMode executable Can one of jvm java or exe
–StopImage Executable that will be run on Stop service signal.
–StopPath Working path for the stop image executable.
–StopClass Class that will be used on Stop service signal.
–StopParams List of parameters that will be passed to either StopImage or StopClass. Parameters are separated using either # or ; character.
–StopMethod Main Method name if differs then main
–StopMode executable Can one of jvm java or exe
–StopTimeout No Timeout Defines the timeout in seconds that procrun waits for service to exit gracefully.
–LogPath working path Defines the path for logging
–LogPrefix jakarta_service Defines the service log filename
–LogLevel INFO Defines the logging level and can be either error, info, warn or debug
–StdOutput Redirected stdout filename
–StdError Redirected stderr filename

注册名称为’Tomcat6’的服务

更新名称为’Tomcat6’的服务信息

移除名称叫’Tomcat6‘的服务

详细见官网:http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html

service.bat 的代码 :

原创文章,转载请注明: 转载自micmiu – 软件开发+生活点滴[ http://www.micmiu.com/ ]

本文链接地址: http://www.micmiu.com/enterprise-app/server/tomcat-windows-service/

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">