I am trying to configure my network interfaces in a way that when I plug in the ethernet cable, wireless will be disabled, and when I plug it back in it will be enabled. So I 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, so I can see wlan0 appears and dissapears all the time. So 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