On Wednesday 04 May 2005 23:21, Gunnar Wolf wrote: > Thomas Hood dijo [Wed, May 04, 2005 at 12:05:19AM +0200]: > > I have been looking at the lsb init functions and am beginning to feel > > that they are a bad idea. > > It will be a hard time converting to them, but in the end I think it > will be a net gain. > > > * Converting to lsb init function requires modifying every initscript in > > Debian. > > > > * Every initscript has to read in a file containing a set of function > > definitions, some/most of which the initscript does not use. > > Yes. Inertia is hard to break - But it is often necessary.
Optimize the easy case: For daemons which interact nicely with s-s-d, a init script should look like this: ----------------------------------------------------------------------- #!/bin/bash NAME=exampled DAEMON=/usr/sbin/exampled MESSAGE="Starting the ExampleD" FLAGS=-default . /lib/handle_init ----------------------------------------------------------------------- Where /lib/handle_init can handle /etc/default/$NAME files, pidfile handling (/var/run/$NAME.pid), s-s-d calls and much more. Do you need more flexibility? Think about {pre,post}-{{re,}start,stop,reload,status} functions. lsb output? rewrite handle_init. lin{da,tian} checkability? quite easy. bootlogging? handle_init just has to properly redirect all output. debconf-interfaces interactive startup? rewrite handle_init. Debug output if -n $PS1? non-sh init scripts? convert handle_init into a binary to be called, which can handle /etc/$NAME/init.d/{pre,post}-{{re,}start,stop,{force-,}reload,status} Regards, David -- - hallo... wie gehts heute? - *hust* gut *rotz* *keuch* - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15