Is there any way to run a script on WAN up down

Is there any way to run a script on lost Internet connection, for example when the WAN goes down and up and run a bash script to send a notification to my local server.

WAN Down: /lost.sh curl Internet connectivity lost
WAN UP: /restored.sh curl Internet connectivity restored

Sure you can use hotplug scripts:

1 Like