At my office, I needed to find a way to turn of the wireless network when someone plugged in their network cable. I also did not want them to be able to turn the wireless network back on until the network cable was unplugged. I came up with the fallowing solution.
I created a launchDaemon called com.companyname.ethernetmonitor, and saved it in /System » Library » LaunchDaemons:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.companyname.ethernetmonitor</string> <key>ProgramArguments</key> <array> <string>/Library/Scripts/CompanyName/turnOffAirport.sh</string> </array> <key>WatchPaths</key> <array> <string>/Library/Preferences/SystemConfiguration</string> </array> </dict> </plist>
#!/bin/sh if ifconfig en0 | grep 155.144; then /usr/sbin/networksetup -setairportpower off else exit 0 fiThis helps keep the user from grabbing two IPs (our wireless and wired network use the same set of IPs), and also helps prevent a few other odd issues when a user is connected to both wireless and Ethernet networks.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100305114751547