29 Apr
2023
29 Apr
'23
12:11
Per Jessen wrote:
I don't know how easy those inotify tools are to use, but it ought to be fairly easy to monitor for a file called 'dhclient6.*ethX.lease' being written to '/var/lib/NetworkManager/'.
Something like this maybe - explicitly not intended as a ready-to-go solution, only as inspiration: inotifywait -m /var/lib/NetworkManager/ |\ egrep 'dhclient6[^.]+\.lease$' |\ while read nmdir events nmfile do echo $events $nmfile do-your-stuff-here done Alternatively, there are some dhcp hooks too, I wonder if they might also be called by NetworkManager. /etc/dhcp/dhclient.d -- Per Jessen, Zürich (11.4°C) Member, openSUSE Heroes (2016 - present) We're hiring - https://en.opensuse.org/openSUSE:Heroes