That sounds like a plan, thanks Corinna. Do we need test how the service (program that cygrunsrv is running) exited? If --neverexits is present, it shouldn't care how it exited, it should just pass the fact that it exited unplanned to the SCM so that the recovery actions take place.
It's only if cygrunsrv is the one that causes the 'service' to exit that the --neverexists shouldn't be considered. Does that make sense? On Wed, Jan 28, 2015 at 5:18 AM, Corinna Vinschen <corinna-cyg...@cygwin.com> wrote: > On Jan 27 15:02, Cary Lewis wrote: >> On Tue, Jan 27, 2015 at 4:09 AM, Corinna Vinschen >> <corinna-cyg...@cygwin.com> wrote: >> > On Jan 26 11:14, Cary Lewis wrote: >> >> I am using cygrunsrv to install a windows service that creates an ssh >> >> tunnel. >> >> >> >> I have configured the service to auto-restart on failures using the >> >> windows 7 services.msc tool. >> >> >> >> If the ssh program exists, or is killed, cygrunsrv gracefully exits, >> >> and the windows auto-restart logic is not invoked. >> >> >> >> Is there a way to get the auto-restart logic to work? >> > >> > Try the cygrunsrv option --neverexits. If this option is set, the >> > service exits without notifying Windows. SCM thinks the service has >> > exited prematurely and restarts it, if auto-restart has been configured. >> > >> >> Corinna, thanks for the tip >> >> --neverexits works, but not if the program that cygrunsrv starts is >> stopped with a kill -9 signal. Perhaps the -9 signal propagates to the >> cygrunsrv.exe program? > > Hmm, yes. Cygrunsrv evaluates how the service process ended, and only > if it exited the neverexits logic comes into play. If it ended due to > a signal, it does nothing. > > This is unfortunate because it diminishes the usefulness of --neverexits. > 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? > > The patch is simple and I could upload a new cygrunsrv today or tomorrow. > > > Thanks, > Corinna > > -- > Corinna Vinschen Please, send mails regarding Cygwin to > Cygwin Maintainer cygwin AT cygwin DOT com > Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple