Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Disable AirPort when Ethernet cable is connected' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Disable AirPort when Ethernet cable is connected
Authored by: SlaunchaMan on Mar 09, '10 08:15:35AM
That script won't work (at least on Snow Leopard), as you need to specify the adapter. Here's a better version (assuming that your AirPort network is en1):

currentNetwork="$(ifconfig ${ETHERNET_INTERFACE} | awk '{ if ( $1 == "inet" ) print $2 }' | cut -d '.' -f 1-2"
currentAirPortPower="$(networksetup -getairportpower ${AIRPORT_INTERFACE} | awk '{ print $NF }')"

if [ "${currentNetwork}" == "${COMPANY_NETWORK}" -a "${currentAirPortPower}" == "On" ]; then
     networksetup -setairportpower ${AIRPORT_INTERFACE} off
elif  [ "${currentNetwork}" != "${COMPANY_NETWORK}" -a "${currentAirPortPower}" == "Off" ]; then
     networksetup -setairportpower ${AIRPORT_INTERFACE} on
Though I haven't tested this script.

[ Reply to This | # ]