On 11/09/2009 11:23 AM, Xan wrote:
En/na Lennart Sorensen ha escrit:
'ethtool' or 'ip link' should be able to tell you if a link is up or
down.
A clever tool would subscribe to netlink and get notifications of link
state changes, but that probably isn't necesary.
I'm planned to write a daemon which change route table according with
the ip link state of eth0. I have two alternatives: use ip link and see
periodically the state of link of eth0 and use netlink. I think the best
it's the second (in the first case I have to wait one hour or one
minute.... for recover eth0 connection after plug).
I have not looked into the details of the issues you are having, and
have not actually used whereami scripts - but the whereami package
description looks to be very close to what you are looking for, and also
would seem to be the natural place to contribute features/functionality
to do what you want, if it does not already. Just an observation. :)