You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mladen Turk <mt...@apache.org> on 2020/11/16 18:12:32 UTC

FYI SvcBatch - Windows service wrapper

Hi,

The current procrun from commons-daemon we use to run Tomcat as
Windows service is not actively maintained any more.

I have created a SvcBatch project that uses different
approach by running batch files as services.

This means that instead complex configuration, one
can use catalina.bat directly, enabling versatile customization

For example to run Tomcat as service, put svcbatch.exe inside
tomcat/bin and create tomcatsvc.bat (or whatever) file with
the following content

@echo off
catalina.bat run

Then install the service by typing in command prompt
 > sc create Tomcat start= auto DisplayName= "Apache Tomcat" binPath= ""%CD%\svcbatch.exe" tomcatsvc.bat"

You can now start tomcat as a service by either typing
 > sc start Tomcat
or
 > net start Tomcat
or by using MMC Servcie GUI, etc.

To get full java thread dump just enter
 > sc control Tomcat 233
Thread dump will end up inside tomcat/bin/Logs/SvcBatch.log

Anyhow, here is the code with more docs (I know ... working on that)

https://github.com/mturk/svcbatch

I'd like to get community feedback on that project, and
if proven useful we might consider using it as addon
or replacement for procrun.


Regards
-- 
^TM

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: FYI SvcBatch - Windows service wrapper

Posted by Mladen Turk <mt...@apache.org>.
On 16/11/2020 20:00, Mark Thomas wrote:
> On 16/11/2020 18:12, Mladen Turk wrote:
>>
>> This means that instead complex configuration, one
>> can use catalina.bat directly, enabling versatile customization
> 
> So to check my understanding:
> - sc.exe is used to manage the service
> - configuration is via the same mechanisms used when starting from the
>    command line
> - svcbatch provides the plumbing to enable a service to be created from
>    a batch file
> - svcbatch requires some configuration but a lot less than procrun
>    because it pushes most of the config to the batch file or sc.exe
>

sc.exe is Microsoft's utility shipped with every Windows
which means that service application does not have to
implement all the installation, removal etc.

svcbatch.exe is service wrapper that basically
runs 'cmd.exe /C myservice.bat'

You can create a simple myservice.bat with arbitrary
content to lunch any app.
I have tested it with all tomcat versions, JBoss EAP,
Kubernetes, Jenkins etc.


>> I'd like to get community feedback on that project, and
>> if proven useful we might consider using it as addon
>> or replacement for procrun.
> 
> Simpler configuration is good. There has been a steady stream of
> enhancement requests to procrun to support various features. If svcbatch
> avoids that then that would be a positive.
> 
> There would need to be a check for feature parity before any discussion
> of replacing procrun.
> 

Sure.


> Any reason not to replace procrun in Commons Daemon?
> 

SvcBatch does not need any Java code, and C code
simply does not belong into commons ecosystem.


Regards
-- 
^TM

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: FYI SvcBatch - Windows service wrapper

Posted by Mark Thomas <ma...@apache.org>.
On 16/11/2020 18:12, Mladen Turk wrote:
> Hi,
> 
> The current procrun from commons-daemon we use to run Tomcat as
> Windows service is not actively maintained any more.

Huh? It most certainly is. There is a release being discussed right now.
I'm left with an unfortunate impression of an attempt to spread FUD
regarding Commons Daemon.

> I have created a SvcBatch project that uses different
> approach by running batch files as services.
> 
> This means that instead complex configuration, one
> can use catalina.bat directly, enabling versatile customization

So to check my understanding:
- sc.exe is used to manage the service
- configuration is via the same mechanisms used when starting from the
  command line
- svcbatch provides the plumbing to enable a service to be created from
  a batch file
- svcbatch requires some configuration but a lot less than procrun
  because it pushes most of the config to the batch file or sc.exe

> I'd like to get community feedback on that project, and
> if proven useful we might consider using it as addon
> or replacement for procrun.

Simpler configuration is good. There has been a steady stream of
enhancement requests to procrun to support various features. If svcbatch
avoids that then that would be a positive.

There would need to be a check for feature parity before any discussion
of replacing procrun.

Any reason not to replace procrun in Commons Daemon?

How does svcbatch compare to jsvc? Is jsvc closer to procrun or svcbatch?

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org