Mailing List Archive


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

Re: [tlug] Perform an action when network cable unplugged (and back in again): have udev call you



>> Interesting idea... but how do I know if udev gets an event?

I think this is still the key question.

> Browse the *.rules files /etc/udev/rules.d/ (at least that's 
> where they are in Centos 5). 

Thanks for the hints.
(On Ubuntu user customizations are there; packages install in
/lib/udev/rules.d/)

I first changed /etc/udev/udev.conf logging from "err" to "debug" (and
"service udev restart").  The I created: 10-darren-test.rules, with this
line:

  ACTION=="add", SUBSYSTEMS=="net", RUN+="/etc/network/darren-testing"

(syslog told me it had been recognized and accepted as soon as I saved
it; if I save a typo it tells me that too.)

That darren-testing file is just a simple logger:
  #!/bin/bash
  echo `date` >>/tmp/darren.log

But it never gets called when I unplug the network cable (or for
anything else so far). So the udev hook is something else (or there
isn't one).

I also tried:
  KERNEL=="*", RUN+="/etc/network/darren-testing"

which I thought was going to be dangerously hyperactive, but not even a
whimper.

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