[avahi] Running avahi-daemon on-demand

Lars Hanisch dvb at flensrocker.de
Wed Feb 5 10:50:23 PST 2014


Am 05.02.2014 17:51, schrieb Till Kamppeter:
> I am responsible for Ubuntu's printing stack and for Ubuntu Touch (the phone OS from Ubuntu) I would like to run the
> three daemons avahi-daemon, cupsd, and cups-browsed on-demend.
> 
> cups-browsed is accessing avahi-daemon via the library functions avahi_glib_poll_new(), avahi_client_new(),
> avahi_service_browser_new(), which is probably using the D-Bus interface (am I right?). Can I have avahi-daemon not
> started and the start it D-Bus triggered, for example through the D-Bus bridge of Upstart?

 As far as I know this should be done by bus-activation of the dbus-daemon. On my Ubuntu 12.04 there is a file called

 /usr/share/dbus-1/system-services/org.freedesktop.Avahi.service

 but it is meant for systemd as the comments show.
 You have to replace the SystemdService/Exec stanzas with something Ubuntu understands. I don't know if you can start
Upstart-Jobs via such a service file. Maybe an "/sbin/initctl start avahi-daemon" is possible, I don't know.

 http://kkaempf.blogspot.de/2009/03/d-bus-service-on-demand.html

> In Upstart I would need to set a rule like (see dbus-event(7) man page on Upstart-enabled distros like Ubuntu):
> 
> start on dbus   [BUS=BUS_NAME]  SIGNAL=SIGNAL  INTERFACE=INTERFACE OBJPATH=PATH SENDER=SENDER DESTINATION=DESTINATION
> ARG0=VALUE ARGN=VALUE
> 
> How do I have to fill in these fields so that the rule gets matched by the first D-Bus call sent by above library
> functions?

 I would start a dbus-monitor, maybe you can trace the messages sent when accessing the Avahi-Bus the first time.
 Maybe "NameHasOwner" will be called, see

 http://dbus.freedesktop.org/doc/dbus-specification.html

Regards,
Lars.

> 
>    Till
> _______________________________________________
> avahi mailing list
> avahi at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi
> 



More information about the avahi mailing list