On-demand starting/stopping of cups [was: [Blueprint client-1305-printing-stack-with-mobile-in-mind] Printing Stack with Mobile in Mind]

Till Kamppeter till.kamppeter at gmail.com
Wed Feb 5 18:53:52 UTC 2014


I had some thoughts about running the daemons on-demand.

Principally, we want the following:

When a user opens the print dialog, avavhi-daemon, cups, and 
cups-browsed should be started (can get called explicitly), as 
cups-browsed will get D-Bus signals from avahi-daemon when printers 
appear or disappear and it will send requests to cupsd to create or 
remove print queues pointing to these printers. The dialog is now 
supposed to watch the print queues appearing and to update the 
user-visible list appropriately, until the user clicks a printer. Then 
printer capabilities should be polled via IPP (using libcups) and if the 
user clicks "Print", the job is sent to CUPS (also using libcups).

When the dialog is closed, we check whether other instances of the 
dialog (or other avahi-daemon-using apps, how do we identify them 
without having an explicit list?) are still running and if not, we kill 
avahi-daemon. cups-browsed and cupsd keep running, we modify 
cups-browsed that it keeps running when avahi-daemon appears and 
disappears and let it remove the job-less (empty) Avahi-discovered 
queues if avahi-daemon disappears.cupsd closes by itself 30 sec after 
there are no jobs any more and cups-browsed closes by itself if it runs 
30 sec without having any cups-browsed-generated print queues, meaning 
that all but the queue which is printuing the user# s job get removed 
when avahi-daemon is killed by the dialog closing and the remaining 
queue gets removed when the job finishes, if within 30 seconds no new 
print dialog gets opened )which starts avahi-daemon) cups-browsed 
closes. These non-permanent (auto-closing) modes of cups-browsed and 
cupsd we are triggered by a special command line option which we will 
introduce to the daemons and use it when calling from the print dialog 
)or when calling cupsd socket-triggered by Upstart).

So we will modify cups-browsed:

- Keep running independent of avahi-daemon running, simply remove the 
empty avahi-detected queues if avahi-daemon disappears and recover to 
avahi use if avahi-deamon reappears.
- Command line option to stop if 30 sec without cups-browsed-created queues.

and cupsd:

- Support for Upstart-induced startup: 
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1276713
- Command line option for stopping when 30 sec without jobs and without 
shared printers (default when Upstart-socket-induced).

WDYT? Should we go this way?

    Till




More information about the ubuntu-devel mailing list