Gentoo Archives: gentoo-server

From: Eric Brown <airuike@×××××.com>
To: gentoo-server@l.g.o
Subject: Re: [gentoo-server] initng and runscript
Date: Thu, 22 Dec 2005 07:27:23
Message-Id: d5b293290512212325l126aef98rbdb24f6bb02b6b88@mail.gmail.com
In Reply to: Re: [gentoo-server] initng and runscript by Kalin KOZHUHAROV
1 On 12/20/05, Kalin KOZHUHAROV <kalin@××××××××.net> wrote:
2 > Eric Brown wrote:
3 > > It's not just init scripts that are designed poorly, it's applications
4 > > that fail to daemonize and dont' return non-zero. (like apache-1.3,
5 > > ntp-date, snort, etc.. most servers).
6 > Yeah, that is the real problem, but that is not fixable immediately.
7 >
8 > > I think the new baselayout has some adjustable sleep/checks on by
9 > > default, but I haven't tries it yet. I suppose that would work by
10 > > having the init script sleep for a short time, then check to see if a
11 > > certain process is running (a dirty hack that's frowned updon by
12 > > some)...
13 > >
14 > > Anyway, I really think this is something worth looking into, either as
15 > > a separate package that implements some kind of monitoring functions
16 > > in init scripts, or as a basic set of monitoring functions that are
17 > > included in baselayout for developers to optionally use.
18 >
19 > > While there are options like daemontools and rmon? I don't think they
20 > > provide a very robust solution to this problem.
21 > Can you elaborate on this? What is wrong with daemontools?
22 >
23 > http://cr.yp.to/daemontools/faq/create.html#why
24 >
25 > > Here's an idea:
26 > >
27 > > Have users emerge a program that can do some basic things:
28 > emerge daemontools
29 >
30 >
31 > > 1) check config scripts of running services for variables like:
32 > > CHECK_COMMAND
33 > svstat /service/daemon
34 >
35 > > SLEEP_TIME
36 > If I get you right, this is hard coded to 1 second for supervise.
37 >
38 > > INIT_SLEEP
39 > If I get you right, this is hard coded to 1 second for supervise.
40 >
41 > > IF_DOWN_DO_THIS
42 > Not sure how important is this, but flexibility can be achieved inside the ./run script of the
43 > daemon. The normal thing is to start it again.
44 > svc -u /service/daemon
45 >
46 > > (those variables could optionally be implemented per package, or
47 > > explicitly disabled, they would have sane defaults in a central .conf
48 > > file for this enhancement package)
49 > This can be worked on, the start is sys-process/daemontools-scripts.
50 >
51 > > 2) is a cron job/daemon that automatically checks all running apps in
52 > > the current runlevel, can report problems (send emails, log stuff,
53 > > etc), can send heartbeat, etc..
54 > Can you trust cron, started from a init script?
55 > Instead a script started under supervise, as simple as this:
56 > #!/bin/bash
57 >
58 > sleep 60;
59 > `svstat /service/* |grep down >/dev/null` && \
60 > echo "Something is wrong" | your_favourite_mailer_here
61 >
62 > (The above is not tested, just thought of. Feel free to improve).
63 > (Like there can be intentionally down-ed services -e /service/daemon/down)
64 >
65 > > 3) is well documented in the gentoo handbook since it's probably a
66 > > vital component
67 > http://cr.yp.to/daemontools.html is a good start, in can be improved for sure.
68 >
69 > > To me this kind of thing is probably simple, unixish, and robust
70 > > enough for most of our needs...
71 > >
72 > > Any thoughs?
73 > Don't top-post :-)
74 >
75 > Kalin.
76 > /known also as Korokoro or tar/
77 >
78 > P.S. Whose MTA changes the subject with [OBORONA-SPAM] ? Please remove that; use a custom header
79 > instead.
80 >
81 > --
82 > |[ ~~~~~~~~~~~~~~~~~~~~~~ ]|
83 > +-> http://ThinRope.net/ <-+
84 > |[ ______________________ ]|
85 >
86 > --
87 > gentoo-server@g.o mailing list
88 >
89 >
90
91 What I don't like about daemontools is that I like our current init
92 system, and daemontools just totally replaces it. With a little
93 effort, it might be possible to simply supplement the init script
94 resources we already have. I would really miss some of the stuff the
95 gentoo devs made easy for us: automatic dependency handling, ease of
96 use w/rc-update, simple configuration symatics for a wide range of
97 daemons (network stuff and drive mounting stuff)...
98
99 Anyway, I'm glad you brought up daemontools, there's a lot to learn
100 from it. Maybe approaching this problem from the other direction
101 would even be a good idea: How can we enhance daemontools to create a
102 new gentoo init script system that's every bit as friendly as the
103 current one?
104
105 --
106 gentoo-server@g.o mailing list