I assume you googled for this and you didn't find anything?
If so, I can only give you some concepts:
With the "ip route" command you can see and you can define the default route. So you can switch between your fixed and 4G connection.
With "ping -I <interface> 126.96.36.199" you can ping a host from a certain interface.
So, combining these commands, I would make such a script (attention: this is pseudocode):
ping 188.8.131.52 from fixed interface
ping 184.108.40.206 from cellular interface
if reachable then switch default gateway to cellular interface
else set fixed as default gateway (if wireless was set)
wait 5 seconds