Using automator or script to turn on wifi in case of ethernet cable failure, and vice versa?

For the moment, I have slightly faulty thunderbolt port on my 2013 mac book pro that I use to connect to the internet. My wifi works fine, but I prefer the increase in speed with the direct line. My concern is that if I accidentally bump anything there it may disconnect. While it doesn't take long to go to network pref. and connect to my network, I'm wondering if there would be a way to use automator or some other means to configure so that in case of a failure on either side for any reason I could automatically connect to the other?

Any advice appreciated!


Isin't 'Set Service Order' in System Preferences > Network sufficient (click circle with three dots inside at the bottom of left pane to see it)?

Setting Thunderbolt Bridge first and active and WiFi second and active should make MacOS switch automatically if first connection becomes unavailable.