X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; q=dns; s=default; b=Ahwah5JW9d5IMCi4
	A3gx02vtzWfgrXRSdyU49oOggKo4E9sfFF9nCMiFYwAfwdFlsMv99nNvBLHD6DNZ
	yWy+qj5EktP0l+qU3b2sdrGPSQTn+5NAh5zzsxtU53xFzGycDb/jQemGvkItEmUP
	ZIL+SEXAYP2eXMdpmHcDShWrWYI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; s=default; bh=2Hr5iIS3fm2ctV4euXHFWI
	MiUYQ=; b=qtVsAUm/IOX+tfClN3ImEdBFI2OgmXSzVzy5syMHATj5LjlD8J6YJG
	zSzHJy8dHk2xG/bsXZuBmoJXjLRF/tYLJqD0Mwn65pQ/MOgeHcyi3sOeYNjfRQyI
	nLd8yzBH1CGP55FAdtbhfAyQnvHxuZaVwjWEs5sZeRaDneud7+bmU=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=1.7 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_BODY_URIBL_PCCC,KAM_FROM_URIBL_PCCC,KAM_THEBAT,SPF_SOFTFAIL autolearn=no version=3.3.2
X-HELO: smtp.ht-systems.ru
Date: Wed, 28 Jan 2015 21:15:18 +0300
From: Andrey Repin <anrdaemon@yandex.ru>
Reply-To: cygwin@cygwin.com
Message-ID: <653921421.20150128211518@yandex.ru>
To: BGINFO4X <bginfo4x@kztsoftware.com>, cygwin@cygwin.com
Subject: Re: cygrunsrv - services enters stopped state if underlying program exits or is   killed - doesn't auto restart
In-Reply-To: <CAO2ddnaVMPhxtX03rMzAZnp1-ifmH+i0pPCYcS3SKrii4BDvgw@mail.gmail.com>
References: <CAEF1h+Wghm86TybnaLMz9TdX5NUV15aNBAC1KZ1dKhUOVZ-_Qg@mail.gmail.com>   <20150127090910.GF14265@calimero.vinschen.de>  <CAEF1h+XeFp_OCDNo-ok_EW=-1h94=mQRRz_ucZsix4wmow+WvQ@mail.gmail.com>  <20150128101833.GX14265@calimero.vinschen.de>  <20150128115518.GZ14265@calimero.vinschen.de>  <CAO2ddnY+fk_CwGTZVyN7u6upZDxOrTbVjUVRCeGj8KBLEDPgig@mail.gmail.com>  <20150128153705.GD14265@calimero.vinschen.de>  <CAO2ddnaVMPhxtX03rMzAZnp1-ifmH+i0pPCYcS3SKrii4BDvgw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Greetings, BGINFO4X!

>>> >> 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?
>>>
>>> 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.

>     - But if the administrator defines the autorestart option, the
> service should be aware of it.

No. Autorestart is there to help recover from service failures, WHEN such
recovery is desired by the system administrator.
It has nothing to do with the nature of the service, neither require service
to be aware of it.


>>> So, --neverxits should be the default behaviour of cygrunsrv , so
>>> --neverexists shouldn't exist as an option. :) But perhaps I'm wrong
>>> and I don't understand completely the problem.
>>
>> I disagree.  Automatic restart of services is not desired by default.
>> It's a per-service, administrators choice.

I think I can explain it a little different.
If we view cygrunsrv as a wrapper(bridge) between Cygwin(POSIX) daemon and
Windows service infrastructure, all what is required from it (beside
environment initialization) is to convert Windows control messages to
appropriate POSIX signals.
And, conversely, appropriately react to POSIX signals when service is
terminating by itself.
I'm not very familiar with passing signals back to called process, but if
cygrunsrv can distinguish graceful termination of controlled daemon from
abnormal shutdown, the "--neverexits" switch become redundant in case of
correct signal mapping.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 28.01.2015, <20:36>

Sorry for my terrible english...


--
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

