When restarting avahi-daemon cups does not reconnect to it - workaround
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
avahi (Ubuntu) |
Fix Released
|
High
|
Dimitri John Ledkov |
Bug Description
I use CUPS with shared printers and the shared printers are Bonjour-broadcasted by Avahi. This works well when avahi-daemon is started before cups and both keep running. But if I restart (stop and start gain) avahi-daemon while CUPS is running, CUPS does not reconnect to avahi-daemon again and so stops broadcasting. What I expect is that CUPS reconnects after the restart of avahi-daemon. This can easily happen if for example the avahi-daemon package gets updated, avahi-daemon crashes, or the admin changes the configuration of avahi-daemon.
I am using Ubuntu Raring (13.04) with CUPS 1.6.2.
The real fix would need to be done in CUPS and therefore I did the following upstream bug report:
https:/
For the time being until CUPS gets fixed I suggest the following workaround:
If one adds the following lines to the end of the /etc/init/
----------
post-start script
if lpstat -h localhost -r 2>/dev/null | grep -qv not; then
killall -HUP cupsd
fi
end script
----------
the CUPS daemon gets kicked after starting avahi-daemon and so reconnects. The "if" only comes true if "lpstat" is present and the answer of "lpstat -h localhost -r" does not contain "not", meaning that the CUPS daemon is running.
This works at least for restarting the avahi-daemon by "stop avahi-daemon; ...; start avahi-daemon" (what happens when updating avahi-daemon) or by the "respawn" (what happens when avahi-daemon crashes).
It does not work with "restart avahi-daemon". Any addition to my suggested workaround to make this work is welcome.
Can this workaround be applied to Raring? Thanks.
Changed in avahi (Ubuntu): | |
importance: | Undecided → High |
milestone: | none → ubuntu-13.04 |
Changed in avahi (Ubuntu): | |
assignee: | nobody → Dmitrijs Ledkovs (xnox) |
status: | New → Triaged |
post-start script
if status cups | grep start/running; then
reload cups;
fi
end script
See http:// upstart. ubuntu. com/cookbook, we want to check for cups that we are managing (not any other) & reload will send to our cups HUP to reload.