Re: executing udev rules on _un_plug
Cameron Hutchison <email@example.com> wrote:
CH> How can I write a udev rule to be run/matched when a device is
CH> I have a 3G modem that I wrote a rule for to run "ifup ppp0" when the
CH> modem is plugged in. I would like to have "ifdown ppp0" be automatically
CH> run when the modem is unplugged.
CH> Without a rule to run "ifdown ppp0", the network state of ppp0 is
CH> remembered as up, so if I plug in the modem again, "ifup ppp0" then
CH> fails because it says the interface is already configured.
when i was using a modem, i used a cronjob that checked for
/var/run/ppp0.pid. when it's not detected, you can have it execute "ifdown