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

Re: Question about Facility names



  OK, Ted fed me a pile of messages in this thread. I won't reply to
them all. I'll just point out a few things here and see where it
leads.

Alan Cox writes:
> > NEED="foo bar"
> > PROVIDES="baz quux"
> > 
> > at the beginning of the shell script, and then reference the shell
> > variables later on in the init script.  That's a pretty easy way to
> > solve the problem.
> 
> You want to be able to extract them in advance so you can tsort and
> lorder the dependancy tree to find loops at install time.

With my scheme, you don't have to worry about loops. It's taken care
of by init(8). It knows whether scripts are running or are blocking in
need(8), and thus knows whether any progress can be made. If no
progress can be made, it signals waiting needers that said service is
unavilable. This means that the needer scripts can decide whether they
will continue providing a service (facility) or give up. In some
cases, need(8) is simply used as a scheduling point (i.e. "I want to
wait for this to start, but if it fails/is not available, I don't
care").

If you have a real dependency loop, then you've designed your init
scripts wrong. What you need to do is break scripts into smaller
pieces.

Also, I specifically decided to have need(8) be a programme that is
run by the script, rather than have init(8) read each boot script
looking for dependencies. This is actually one area where Patrick and
I disagreed at first. While it's true that parsing the scripts would
make some things easier, it's just a way of digging yourself into a
hole. You end up needing to write a parser. Because just putting:
NEED="net-interfaces"

in the script is *not* what you want. You may put the dependency
inside a conditional. Simple case: different behaviour for "start",
"stop", "restart" and so on. So you would have to write a more
advanced parser. Eventually, you've written bash. No thanks.
Also, it would prevent people from writing scripts in a different
shell (in general a bad idea, but someone may need to do it), and it
would prevent having binaries (daemons) directly in the script
directory (which would save a level of indirection).

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca



Reply to: