I wrote a script, which given a network interfacewifi-reminder wlan0will monitor the network traffic. If an average transfer speed over a predefined interval will fall below a predefined speed. (e.g. average speed < 5.0 kB/s), it will send a notification.Now, I'd like to integrate it with NetworkManager. I know I could use the dispatcher to call the program whenever a wl* interface is up. The problem is: I'd like to kill the script instance tied to the specific interface when the network interface is down. killall is no safe option for scripts. My init system is systemd. Do you have any idea how to do it without hassle? One idea that comes to my mind is to write the PID down somewhere in /tmp and recall it on interface down, but maybe I'm reinventing the wheel? We have the init systems, after all.
Starting and stopping a script with the NetworkManager dispatcher
scripting;networkmanager