I have a Raspberry Pi which is connected to the internet through a USB rocket stick. I also have it connected to a switch on local network via Ethernet (eth0 interface). This switch allows me to turn the ports up or down manually. If the rocket stick goes down, I want to be able to get access to the unit through the other network. If the eth0 port is connected, I want the rocket stick to disconnect. I do not want both interfaces up at the same time. I have a script that will do this but I cannot get it to run when the eth0 interface is connected. I have tried the script by itself and it works with no issues. I have placed the script in the /etc/network/if-up.d/ directory but it still will not run when I connect the interface. It only runs when the device boots.
Any help would be appreciated.