Script to switch between ethernet and usb/cellular based on internet connection

Has anyone come across a script/way to automatically switch to cellular when ethernet is disconnected to the internet. And then back to ethernet when connection is restored? I thought the OS would take care of this well, but not so much. Using Debian (not using sixfab tools & using for service).