Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Perform an action when network cable unplugged (and back in again)



My notebook, running ubuntu 10.04, is almost all the time using a wired
connection, with static IP address. When I pull the network cable out of
my notebook (and then plug it in again) I see these entries in /etc/syslog:

Jun 12 09:04:45 myhost kernel: [479179.526691] r8169: eth0: link down
...
Jun 12 09:08:40 myhost kernel: [479414.948768] r8169: eth0: link up

What I'd like to do is run a command when we get link down (I'd like to
unmount a network drive), and run another command when we get link up
(remount the drive). Are there any hooks in linux for this? (I know we
have if-up.d and if-down.d for the interfaces, but those scripts are not
being run when just the cable is pulled out; I'm looking for the "link"
equivalent of those directories.)

Does such a thing even exist?

Thanks,

Darren

-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links