Listening to physical port connection/disconnection events

how can I programmatically listen to an event if a network device has disconnected or connected ethernet cable to the router?

In OpenWRT interface updates are registered through PROCD but it is not working in TOS

and the developers cannot be bothered since months however

It needs a hotplug script instead, perhaps until some unknown date TOS 4.x might be released (if ever).

For a hotplug script you may find some inspiration from one located in /etc/hotplug.d/iface/, something like

if [ "$ACTION" != "ifup" ] && [ "$ACTION" !=

This might work for the WAN interface, but I wouldn’t expect it to work for switch ports, as they aren’t directly exposed as interfaces.