On 2026-01-08, Michael P. Soulier wrote:

> Is there a way to run a script when an interface comes up when using
> NetworkManager? The post-up hook in interfaces is great, but I'm trying to run
> an ethtool command when I plug into my docking station and suddenly it's
> ethernet interface is available. 

You can put any command in post-up or if you prefer you can add a script
in /etc/network/if-up.d such this one:

$ cat /etc/network/if-up.d/postfix 
#! /bin/sh
# update postfix copy of resolv.conf (picked up automatically); only default 
instance is handled
[ lo != "$IFACE" ] && cp -pLu /etc/resolv.conf 
/var/spool/postfix/etc/resolv.conf 2>/dev/null || :

Reply via email to