Gentoo Archives: gentoo-dev

From: "leon j. breedt" <ljb@×××××××××.org>
To: Wouter van Kleunen <kleunen@××××××××××.nl>
Cc: gentoo-dev@g.o
Subject: Re: [gentoo-dev] Init replacement
Date: Sun, 04 May 2003 04:25:42
Message-Id: 20030503132044.GA7084@noa.mshome.net
In Reply to: Re: [gentoo-dev] Init replacement by Wouter van Kleunen
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 On Sat, May 03, 2003 at 11:08:55AM +0200, Wouter van Kleunen wrote:
5 > Yes. I have thought of adding a script-service. But i removed it, because
6 > i do not like scripts. I agree that they are convenient for executing a
7 > collection of commands, but bash is a very weak programming language.
8 well, you don't really need a programming language for init scripts themselves,
9 conceptually you're not doing anything complex enough in them to warrant
10 it. especially not if you have a compiled program doing all the calculations
11 requiring data structures.
12
13 for execution of commands, manipulating files quickly, and all the kinds of
14 housekeeping things you typically want to do to start a "difficult" daemon,
15 something which cannot be neatly done with a one line command like
16 start-stop-daemon, a shell script is actually the most suitable solution,
17 in my opinion. i really would not recommend requiring that it be an
18 actual programming language, that would really limit adoption of your program
19 to a far too small audience...
20
21 how i planned to implement my version, was to have
22 a file /etc/svc.d/<name>, which described the service. in this file, you
23 would declare dependencies, security attributes, etc. and also specify the
24 command to start and to stop the service, which could refer to seperate
25 scripts or just be oneliner commands.
26
27 something like:
28
29 start: /usr/sbin/exim -q15m -bd
30
31 or
32
33 script: exim
34
35 where the first would start the daemon, and to stop it, send a KILL signal
36 (implied by a missing stop: keyword). and the second would expect the script
37 (located in /etc/svc.d/scripts) to accept 'start' or 'stop' arguments.
38
39 a symlink in /etc/init.d/<name> => /sbin/svc would emulate the current behaviour
40 of init scripts by running as if you'd executed 'svc <action> <name>', where
41 <action> would be the argument you supplied when executing it.
42
43 there will always be daemons which require more care and feeding than
44 well-behaved ones, at some point to handle these you're going to have to
45 allow execution of scripts, or reinvent your own scripting language again :)
46
47 another thing which i think may be useful, include or exclude at your
48 discretion, is to allow execution of scripts on entering/exiting a profile
49 (or runlevel as sysvinit calls it).
50
51 for example, if i drop down to single user profile, maybe i have some
52 commands i want to execute before the shell appears.
53
54 just some ideas...
55
56 leon
57
58 - --
59 in the beginning, was the code.
60
61 -----BEGIN PGP SIGNATURE-----
62 Version: GnuPG v1.2.1 (GNU/Linux)
63
64 iD8DBQE+s8IsRWcl5mzp4f4RAgpLAJsFL+W/JZYRdHUBp6DJ36o6IBX5pQCfUzvM
65 dZjX/0Gzge4Dp93aH2Ne36A=
66 =Cx6r
67 -----END PGP SIGNATURE-----
68
69 --
70 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Init replacement Paul de Vrieze <pauldv@g.o>