Execute a script when Network device 'eth0' link is down

Hello OpenWrt community,

Here is what I would like:

When I manually unplug my Ethernet cable and when the following log message appears: "daemon.notice netifd: Network device 'eth0' link is down"

I would like to execute a script.

I've also tried to use the following script located in /etc/hotplug.d/iface/ but it only work during the boot process.

[ "$ACTION" == "ifdown" ] && [ "$INTERFACE" == "eth0" ] && {

    logger -t "eth0 down test";

}

Thank you.

Move your script to /etc/hotplug.d/net/ and change the action to "remove".

[ "$ACTION" == "remove" ] && [ "$INTERFACE" == "eth0" ] ...
3 Likes

It worked!
Thanks.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.