开发者

How does Tomcat set its executable file as a Windows service?

Firstly, I am not at all familiar with Windows batch file programing. Recently I am curious about how Tomcat sets itself as a Windows service using a batch file. I downloaded the service.bat file from Tomcat 6. However, I still don't understand some part of it.

I guess this is the line that the batch actually register the EXE file to the OS, is it right? Is there any syntax explanation?

"%EXECUTABLE%" //IS//%SERVICE_NAME% --StartClass org.apache.catalina.startup.B开发者_开发百科ootstrap --StopClass org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop

And is this used to remove the service?

"%EXECUTABLE%" //DS//%SERVICE_NAME%

And this is the setting of the parameters?

"%EXECUTABLE%" //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm


IS - Install Service

DS - Delete Service

US - Update Service

If you want to create your own services in a batch file look into using sc.exe instead. Run it by itself on a command line for help.

The executable you install as a windows service must be implemented as a windows service. If it isn't, you need some wrapper that is an official windows service and runs the target exe. Some commercial examples:

http://www.eltima.com/products/application-as-service/

http://www.firedaemon.com/

I'm surprised I didn't find an open-source/free option. This type of thing could be done in C# in less than 50 lines of code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜