:: Re: [Dng] printing (was Re: Readine…
Página Inicial
Delete this message
Reply to this message
Autor: Steve Litt
Data:  
Para: dng
Assunto: Re: [Dng] printing (was Re: Readiness notification)
On Sun, 14 Jun 2015 12:27:37 +0200
Laurent Bercot <ska-devel@???> wrote:

> On 14/06/2015 11:58, KatolaZ wrote:
> > Sorry for asking a silly question, but what's the problem in having
> > cups "running" all the time? And better, if you start/stop cups when
> > you need it, why should cups notify systemd (or any other init) that
> > it is ready to do things? Why should init be informed of the fact
> > that a daemon is running or not, except maybe at boot time, and
> > just for the sake of allowing parallel boot?
>
> It's not about parallel boot, it's about reliability, even in the
> case of sequential boot. It's also not about notifying init, it's
> about notifying services that depend on it, which is generally
> handled by a centralized service manager - and systemd is such a
> centralized service manager that also runs as init.
>
> Say you have an awesome automatic Web printing service; it should
> not be activated before CUPS is ready, else it will not work and
> clients will complain. How do you make sure you don't start it too
> early ?



The way I would do it is like this:

====================================================
if ! lynx --dump 127.0.0.1:631 | \
 grep "Overview of CUPS" 2>/dev/null 1>/dev/null; then
    sleep 5
    exit 1
fi
exec my_awesome_automatic_web_printing_service --foreground
====================================================


If you know what the dependent service is supposed to do, you just
stimulate it to do that, and if it does, it's ready, otherwise not.

> Of course, you might not have a use for the mechanism, and if
> Devuan's only intended audience is desktop PC users who don't care
> about reliability, then it does not matter. But readiness
> notification is a real engineering issue that needs to be solved.


It certainly is easier and probably much more efficient than making up
your own test for each service being ready. My preceding thing dumped
a whole web page just to answer a simple question. If the CUPS service
had just told me it was ready, it would have been much more efficient,
even if I were still polling.

SteveT

Steve Litt
June 2015 featured book: The Key to Everyday Excellence
http://www.troubleshooters.com/key