NetworkManager: execute script when network interface disconnects

43 views Asked by At

I need to listen to changes on my network interfaces (Debian, via NetworkManager) and execute a script immediately when a specific change (here: a specific network interface is not longer there) is detected.

Take for example wlan0. As soon as the interface disconnects, said shell-script should be executed. This change needs to be detected and acted upon in under a second.

Periodic checks (e.g. via crond) are not an option, as they'd only run once per minute. Writing a script that constantly (actively) checks by polling the interface every 0.5 seconds is an option I'd rather want to avoid, too.

Any other option one could advise me?

0

There are 0 answers