:: Re: [Dng] printing (was Re: Readine…
Etusivu
Poista viesti
Vastaa
Lähettäjä: Laurent Bercot
Päiväys:  
Vastaanottaja: dng
Aihe: Re: [Dng] printing (was Re: Readiness notification)
On 14/06/2015 15:29, Nikolaus Klepp wrote:
> And I thought the historic solution would be to give your web printing service an id higher than cups, eg.:
>
> /etc/rc*/S04cups
> /etc/rc*/S99awsomewebprinter
>
> Together with the nightmare from unix museum (aka fork when ready) it simply works.


No, it doesn't.
The S04cups script will start cups, spawn the process, but exit before the
service is ready; your sysv-rc mechanism will only see S04cups die, think
it's okay, and start S99awsomewebprinter. There is a race condition and
the web printing service may be started too early.
Unless cups implements readiness notification, and S04cups waits for this
notification before returning. Then S99awsomewebprinter will only be
started once the cups service is *actually* running.

It's not a theoretical problem. It's a very real one. Some daemons take
ages to get ready after they've been started, their needed prep work is
longer than it takes for a shell script to exit and another one to be
spawned, and the race condition is real.

Again, depending on your needs, you may not have experienced it, or you may
not care. That's fine. But it's still there.

--
Laurent