[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Init : someone could comment this ?



Nils Philippsen <nphilipp redhat com> writes:

>> I think, nobody doubts that current initsystem is the worst one of
>> the major linux distributions.
>
> Can the hyperbole please -- we know what we have otherwise we wouldn't
> be having this discussion.

I can not remember how long there are discussions about replacing
RH's initsystem (perhaps 5-6 years), and nothing happened.  Other
distributions implemented more (upstart, syslog-ng) or less (suse,
mandriva) innovative methods in the meantime.  And now, RH tries to
write its own implementation by adding some d-bus features and using
a bloaty scripting language around current initscripts?


>> By changing paradigm from forking to non-forking daemon you can avoid
>> all the complicated 'stop' code; e.g. 'start' will be
>> 
>> | pid = fork();
>> | if (pid==0) { /* ... */ execve(...); }
>> 
>> and 'stop' be
>> 
>> | kill(pid, SIGTERM); /* wait for timeout/sigchld */ kill(pid, SIGKILL);
>
> That'd be all fine and dandy for daemons that simply need to be
> started

how much resp. which daemons are not in this category?


> without any variable options

options are trivially to solve; e.g. by an easy to parse one-option-per-line
configuration file or by 'argv = --foo --bar' stylish options in the service
description file.


> or preparations

trivially to be solved by executing helper scripts instead of the daemon
itself

| #!/bin/sh
| ... do something ...
| exec <daemon> "$@"


Or, by using syslog-ng ideas of scripts (which terminate) and daemons
(which stay running), you can split complicated preparation code and
simple startup code in a way like

--- daemons/foo ---
require = scripts/foo
daemon  = /usr/sbin/foo

--- scripts/foo ---
exec    = /usr/libexec/foo-prepare


> and are obliging enough to write pid files.

pid files are an anachronism required for initsystems with forking
daemons


> I don't think that e.g. the postgresql

works perfectly in this way; e.g. I start it with

| /usr/bin/setuidgid postgres /usr/bin/postmaster -D /var/lib/pgsql/data


>> But python or other bloaty scripting languages are not a solution and
>> completely unacceptable at this place.
>
> "Bloaty" is something that could be solved, don't you think?

Not with python or perl. Perhaps lua.  But I really do not see why an
extra scripting language is required for the initsystem.  sh/bash is
perfect for doing potential preparation tasks.


> bash takes up about 5.1MB.

you mean the 750kb sized 'bash' binary and the >4 MB documentation plus
locale files?



Enrico


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]