cygrunsrv - services enters stopped state if underlying program exits or is killed - doesn't auto restart
Kizito Porta Balanyà
Fri Jan 30 03:24:00 GMT 2015
2015-01-28 21:43 GMT+01:00 Corinna Vinschen <firstname.lastname@example.org>:
> On Jan 28 16:58, BGINFO4X wrote:
>> 2015-01-28 16:37 GMT+01:00 Corinna Vinschen <email@example.com>:
>> > On Jan 28 15:42, Kizito Porta Balanyà wrote:
>> >> 2015-01-28 12:55 GMT+01:00 Corinna Vinschen <firstname.lastname@example.org>:
>> >> >> I could patch cygrunsrv to do this:
>> >> >>
>> >> >> If the service exited due to a signal, and if that signal is not the
>> >> >> defined termination or shutdown signal (default SIGTERM for both),
>> >> >> and if --neverexits has been defined, then performas the neverexits
>> >> >> action.
>> >> >>
>> >> >> Does that sound ok?
>> >> I would say that this should be the default behavior:
>> >> If the signal is SIGTERM and the service is configured to restart the
>> >> program, then restart the program.
>> > No. SIGTERM (rather: the defined termination signal) is send
>> > explicitely from cygrunsrv to the service process to stop the service.
>> > If this is handled like --neverexits, it would be impossible to stop a
>> > service manually. The neverexits case should only cover the cases of
>> > exiting as a result of an unexpected signal (SIGSEGV, etc).
>> I explained it bad. English is not my "default" language. :)
>> What I mean is:
>> - If the automatic restart of the service is defined by the
>> administrator, the service should restart by default.
>> - So, It shouldn't be necessary to register the service with --neverexits.
> Ok, I get your drift. You're right, but this is a bit more complicated
> than the simple tweak I applied to cygrunsrv today.
> There's certainly room for improvement in cygrunsrv. It's showing its
> age, most of the code is unchanged since Cygwin still supported NT4.
> It's not using the QueryServiceConfig2/ChangeServiceConfig2 functions at
> I wouldn't be too unhappy about a developer having fun to improve
Hello, I can't develop it. I don't have the level. But ...
Perhaps the author of nssm can do it (http://nssm.cc/). I could send
an email to him ... for example .....
Or perhaps there is code there (nssm is public doamin) that can be
useful for cygrunsrv .
Note: nssm is a windows program very similar to cygrunsrv.
"nssm is a service helper which doesn't suck. srvany and other service
helper programs suck because they don't handle failure of the
application running as a service. If you use such a program you may
see a service listed as started when in fact the application has died.
nssm monitors the running service and will restart it if it dies. With
nssm you know that if a service says it's running, it really is.
Alternatively, if your application is well-behaved you can configure
nssm to absolve all responsibility for restarting it and let Windows
take care of recovery actions.
nssm logs its progress to the system Event Log so you can get some
idea of why an application isn't behaving as it should.
nssm also features a graphical service installation and removal
facility. Prior to version 2.19 it did suck. Now it's quite a bit
> Corinna Vinschen Please, send mails regarding Cygwin to
> Cygwin Maintainer cygwin AT cygwin DOT com
> Red Hat
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin