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 1DuwSj-00004M-NH
	for garchives@archives.gentoo.org; Tue, 19 Jul 2005 18:05:02 +0000
Received: from robin.gentoo.org (localhost [127.0.0.1])
	by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j6JI2sb9001496;
	Tue, 19 Jul 2005 18:02:54 GMT
Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91])
	by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j6JHxUJj006479
	for <gentoo-dev@lists.gentoo.org>; Tue, 19 Jul 2005 17:59:30 GMT
Received: from rsm.demon.co.uk ([80.177.111.50] helo=mail.ubernet)
	by anchor-post-33.mail.demon.net with esmtp (Exim 4.42)
	id 1DuwON-000Cuy-Bl
	for gentoo-dev@lists.gentoo.org; Tue, 19 Jul 2005 18:00:31 +0000
Received: from uberpc.ubernet (uberpc.ubernet [192.168.2.10])
	(using TLSv1 with cipher RC4-MD5 (128/128 bits))
	(No client certificate requested)
	by mail.ubernet (Postfix) with ESMTP id 66AF02B400A
	for <gentoo-dev@lists.gentoo.org>; Tue, 19 Jul 2005 19:00:31 +0100 (BST)
Subject: Re: [gentoo-dev] init script guidelines
From: Roy Marples <uberlord@gentoo.org>
To: gentoo-dev@lists.gentoo.org
In-Reply-To: <16CC9569DA3E4D41A1D4BC25D7B5A16A473A7C@hercules.magbank.com>
References: <16CC9569DA3E4D41A1D4BC25D7B5A16A473A7C@hercules.magbank.com>
Content-Type: text/plain
Date: Tue, 19 Jul 2005 19:00:30 +0100
Message-Id: <1121796031.10337.6.camel@uberpc.ubernet>
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
X-Mailer: Evolution 2.2.1.1 
Content-Transfer-Encoding: 7bit
X-Archives-Salt: dacfc8ff-bda0-44ea-876e-b9023c510dde
X-Archives-Hash: 17117bab2eb802c757906855152c8f2b

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

-- 
gentoo-dev@gentoo.org mailing list