[avahi] Automatically do something, when a service has been published?
Michael Schmarck
michael.schmarck at habmalnefrage.de
Sat Aug 23 11:14:28 PDT 2008
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”.
--
Thanks a lot,
Michael
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
More information about the avahi
mailing list