Hi Michael, On 24/08/2008, at 2:14 AM, Michael Schmarck wrote:
> Hello. > > Using Avahi, can I setup the systems so, that they > automatically do something, as soon as a service > is available? > > More specific: > I'd like to start a NFS client (ie. portmap and also > autofs) on a notebook only, if there's one (or more) > NFS server available. > > On the servers, I've added the following nfs.service > file: > > <?xml version="1.0" standalone='no'?><!--*-nxml-*--> > <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> > <service-group> > <name replace-wildcards="yes">%h</name> > <service> <type>_nfs._tcp</type> <port>2049</port> </service> > <service> <type>_nfs._udp</type> <port>2049</port> </service> > </service-group> > > When I now do a "avahi-browse -a", I see (amongst > other things): > > --($ /etc/avahi)-- avahi-browse -a > [...] > + eth0 IPv4 HD Network > File System local > + eth0 IPv4 HD > _nfs._udp local > [...] > > (The hostname is “HD”.) > > I could of course setup a cron job which runs every > minute (or whatever period) and which calls “avahi-browse > -t _nfs._tcp” and then does something. But I don't > think that this is, uhm, “elegant” :) > > Can I somehow setup my systems (client and/or server) > in such a way, that the client does “something” (eg. > start NFS stuff, in my case) as soon as a service > is available? I think the key here is “as soon as”. Avahi doesn't support anything like this right now (some kind of 'callout' based script for services appearing/disappearing) You would need to write a new program making use of the Avahi API that did this. Of course while mounting NFS mounts may seem useful.. actually stopping or starting portmap etc seems silly.. why not just leave it running? Regards, Trent _______________________________________________ avahi mailing list avahi@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/avahi