I want to run a script when the switch goes down and an other when it goes up. Is there an easy way to pull this off in Debian (preferably with no other than system tools)?
I suppose there is no difference (in the OS point of view) between unplugging ethernet cable and the switch losing power.
On an event I get lines like these in the syslog:
Jun 15 17:49:41 debian kernel: [ 5506.956130] igb: eth1 NIC Link is Down ... Jun 15 17:49:45 debian kernel: [ 5511.168788] igb: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
In FreeBSD you can pipe log messages (pre-filtered by regex patterns) to a program. What is the easiest way to replicate this on Debian (with as little additional software as possible)?