I am trying to configure my network interfaces. I would like to make my wireless interface to be disabled when I plug in an Ethernet cable. When I take the Ethernet cable out, my wireless interface should be enabled again.
I have created /etc/network/if-up.d/wlan-down:
#!/bin/sh [ "$IFACE" != "eth1" ] || exit 0 ifdown wlan0 exit 0
#!/bin/sh [ "$IFACE" != "eth1" ] || exit 0 ifup wlan0 wpa_cli -i wlan0 reassociate exit 0
but it just doesn't seem to work at all. WPA still tries to connect all the time. I can see wlan0 appears and disappears all the time. My questions are:
- How can I debug these scrips, e.g. what happened and what was executed?
- What is the correct way to implement what I am after?
- Also, it seems that nothing happens when I disconnect the Ethernet cable. The interface is up and the IP address is assigned. I would like to get it down in such a case, so that I could use wireless instead.
I am using Debian unstable