X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT 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 Reply-To: cygwin AT cygwin DOT com Message-ID: <653921421.20150128211518@yandex.ru> To: BGINFO4X , cygwin AT cygwin DOT com Subject: Re: cygrunsrv - services enters stopped state if underlying program exits or is killed - doesn't auto restart In-Reply-To: References: <20150127090910 DOT GF14265 AT calimero DOT vinschen DOT de> <20150128101833 DOT GX14265 AT calimero DOT vinschen DOT de> <20150128115518 DOT GZ14265 AT calimero DOT vinschen DOT de> <20150128153705 DOT GD14265 AT calimero DOT vinschen DOT de> 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 AT yandex DOT 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