So I'm battling away trying to implement a script that tests whether I've got a wired internet connection (if wired, set up access point; or if unplugged, connect to wifi)
So I've worked out how to test if my link layer is up using ethtool eth0. This spits out a page or so of information, but what it also contains:
Code: Select all
Link detected: yes
Code: Select all
if (ethtool eth0 | grep "Link detected: yes")
#take down wifi, bring up AP
else
#take down AP, bring up WiFi
fi