Gentoo Archives: gentoo-dev

From: Paul de Vrieze <pauldv@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] init script guidelines
Date: Tue, 23 Aug 2005 14:15:45
Message-Id: 200508231609.52681.pauldv@gentoo.org
In Reply to: Re: [gentoo-dev] init script guidelines by Roy Marples
1 On Tuesday 19 July 2005 20:00, Roy Marples wrote:
2 > On Tue, 2005-07-19 at 12:42 -0400, Eric Brown wrote:
3 > > The real problem is not that the daemons don't return errors, but
4 > > that our init scripts do not make reasonable attempts to verify
5 > > service startup. If a Gentoo init script claims that a service
6 > > started, it should make an effort to check that the processes are
7 > > actually running shortly after the script is run, even if
8 > > start-stop-daemon says the parent process initialized. Relying on
9 > > the return value of start-stop-daemon is simply insufficient for some
10 > > services.
11 >
12 > I agree.
13 >
14 > Infact, rc-services.sh (/lib/rcscripts/sh) has been totally re-written
15 > for the baselayout-1.12.x branch. It now intercepts calls to
16 > start-stop-daemon and checks if the daemon is still active after a
17 > default time of 0.1 (adjustable) seconds. If not, the we assume the
18 > daemon failed. This solves many existing bugs :)
19 >
20 > Also, we kill any rogue processes and other such checks when a stop
21 > call to start-stop-daemon is made - which is handy for when asterisk
22 > fails to start and leaves mpg123 processes lying around :)
23 >
24 > Check it out when baselayout-1.12.0pre1 hits portage!
25 >
26 > Caveat: - some init scripts abuse start-stop-daemon. One example are
27 > all courier scripts which pass the env program as a daemon. This is
28 > easily worked around, but we fail badly if env then calls a shell
29 > script which in turn launches a daemon. Of all the server stuff I run,
30 > only couier has this issue - but there may be other programs too.
31 > Basically start-stop-daemon should only call daemons!
32
33 What I would really like to see in the init system is a way that
34 initscripts can check whether the services they are responsible for are
35 still running and then adjust their status accordingly, along with some
36 nice output. This would then allow the execution of rc-status to give
37 proper information of actually running daemons, and the "rc" command the
38 possibility to actually bring online all daemons that should be running.
39
40 Paul
41
42 --
43 Paul de Vrieze
44 Gentoo Developer
45 Mail: pauldv@g.o
46 Homepage: http://www.devrieze.net

Replies

Subject Author
Re: [gentoo-dev] init script guidelines Roy Marples <uberlord@g.o>