I have a script that I want to be executed when the wireless lan interface is taken down. I have tried both the following: a) place a script in /etc/network/if-down.d; b) place a script in /etc/NetworkManager/dispatcher.d. As far as I can tell, a) has no effect (the script is never run). For b) the script is run sometimes, but not when the wlan interface is taken down. For debugging purposes I have this:
Code: Select all
> cat /etc/NetworkManager/dispatcher.d/00-log-iface-events.sh
#!/usr/bin/env bash
interface=$1
event=$2
echo "===========" >> /tmp/Hello-there.txt
echo "$interface received $event" >> /tmp/Hello-there.txt
Code: Select all
sudo ip link set wlx7cdd905b9c3d down
I then do
Code: Select all
sudo ip link set wlx7cdd905b9c3d up
Code: Select all
===========
wlx7cdd905b9c3d received dhcp4-change
===========
wlx7cdd905b9c3d received dhcp6-change
One additional data point: if I reboot with that script in place in /etc/NetworkManager/dispatcher.d, an "up" event is logged in the tmp file, so it seems that things do behave the way I was expecting when the wlan is first brought up.
Any ideas?