Hook scripts upon network disconnection

I want once VDSL goes down to fire some script so I can enable on demand the 4g interface. I want this appproach instead of mwan3 because I want to save data and apply my own failover rules upon a specific event instead of having mwan3 to configure it.

The reason why I want this approach is that I want to route all the traffic upon 4g only when vdsl is down. I want no connection balancing just pure routing replacement to a specific interface what will goes up only when dsl goes down as well.

Also default mwan3 script uses ping but instead I want to avoid that and use hook scripts upon dls going down.

So how I can run a shell script once dsl interface goes down?

I use pure SSH without lucy.

Take a look at Hotplug.