From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org)
	by nuthatch.gentoo.org with esmtp (Exim 4.43)
	id 1Dv0Qa-0006ul-1B
	for garchives@archives.gentoo.org; Tue, 19 Jul 2005 22:19:04 +0000
Received: from robin.gentoo.org (localhost [127.0.0.1])
	by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j6JMIQa7019134;
	Tue, 19 Jul 2005 22:18:26 GMT
Received: from mail.pnpitalia.it (ip-pub.fastwebnet.it [85.18.21.122] (may be forged))
	by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j6JMGkeu029908
	for <gentoo-dev@lists.gentoo.org>; Tue, 19 Jul 2005 22:16:46 GMT
Received: from localhost (localhost [127.0.0.1])
	by mail.pnpitalia.it (Postfix) with ESMTP id 8C5DD7AD553
	for <gentoo-dev@lists.gentoo.org>; Wed, 20 Jul 2005 00:16:46 +0200 (CEST)
Received: from mail.pnpitalia.it ([127.0.0.1])
 by localhost (db [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
 id 30774-10 for <gentoo-dev@lists.gentoo.org>;
 Wed, 20 Jul 2005 00:16:46 +0200 (CEST)
Received: from [192.168.4.153] (unknown [192.168.4.153])
	by mail.pnpitalia.it (Postfix) with ESMTP id 250777AD552
	for <gentoo-dev@lists.gentoo.org>; Wed, 20 Jul 2005 00:16:46 +0200 (CEST)
Message-ID: <42DD7BDB.5000600@gentoo.org>
Date: Wed, 20 Jul 2005 00:16:59 +0200
From: Francesco R <vivo@gentoo.org>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
MIME-Version: 1.0
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] init script guidelines
References: <16CC9569DA3E4D41A1D4BC25D7B5A16A473A7C@hercules.magbank.com> <1121796031.10337.6.camel@uberpc.ubernet>
In-Reply-To: <1121796031.10337.6.camel@uberpc.ubernet>
X-Enigmail-Version: 0.92.0.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Virus-Scanned: amavisd-new at db
X-Archives-Salt: 6b248e71-4348-4bbb-82a1-eec740479aca
X-Archives-Hash: 600069401d696445b4502d82f6bebbb6

Roy Marples wrote:

>On Tue, 2005-07-19 at 12:42 -0400, Eric Brown wrote:
>
>
>  
>
>>The real problem is not that the daemons don't return errors, but that our init
>>scripts do not make reasonable attempts to verify service startup.  If a Gentoo
>>init script claims that a service started, it should make an effort to check
>>that the processes are actually running shortly after the script is run, even if
>>start-stop-daemon says the parent process initialized.  Relying on the return
>>value of start-stop-daemon is simply insufficient for some services.
>>    
>>
>
>I agree.
>
>Infact, rc-services.sh (/lib/rcscripts/sh) has been totally re-written
>for the baselayout-1.12.x branch. It now intercepts calls to
>start-stop-daemon and checks if the daemon is still active after a
>default time of 0.1 (adjustable) seconds. If not, the we assume the
>daemon failed. This solves many existing bugs :)
>
>Also, we kill any rogue processes and other such checks when a stop call
>to start-stop-daemon is made - which is handy for when asterisk fails to
>start and leaves mpg123 processes lying around :)
>
>Check it out when baselayout-1.12.0pre1 hits portage!
>
>Caveat: - some init scripts abuse start-stop-daemon. One example are all
>courier scripts which pass the env program as a daemon. This is easily
>worked around, but we fail badly if env then calls a shell script which
>in turn launches a daemon. Of all the server stuff I run, only couier
>has this issue - but there may be other programs too. Basically
>start-stop-daemon should only call daemons!
>
>http://bugs.gentoo.org/show_bug.cgi?id=98745
>
>Roy
>  
>

what about to define two additional functions

check_startup() and check_shutdown()

intended to be filled from package mantainer.
The rc scripts can call these one to check if a service is
started/stopped or not.
If not it wait and retry untill a timeout is reached.

This open the road also to centralized policies of waits between check
like :
(1,1,1,1,1,1) (1,2,3,4,5,6) (1,2,4,8,16,32) and other nice stuff.

Francesco
-- 
gentoo-dev@gentoo.org mailing list