{"id":2629,"date":"2010-03-09T12:52:51","date_gmt":"2010-03-09T16:52:51","guid":{"rendered":"http:\/\/www.schollnick.net\/wordpress\/?p=2629"},"modified":"2010-03-09T13:08:03","modified_gmt":"2010-03-09T17:08:03","slug":"disable-airport-when-ethernet-cable-is-connected","status":"publish","type":"post","link":"http:\/\/www.schollnick.net\/wordpress\/2010\/03\/disable-airport-when-ethernet-cable-is-connected\/","title":{"rendered":"Disable AirPort when Ethernet cable is connected"},"content":{"rendered":"<p><a href=\"http:\/\/www.macosxhints.com\/article.php?story=20100305114751547\">From MacOSXHints&#8230;<\/a><\/p>\n<blockquote><p>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.<\/p><\/blockquote>\n<p>I created a launchDaemon called com.companyname.ethernetmonitor, and saved it in \/System\/Library\/LaunchDaemons:<\/p>\n<pre>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;!DOCTYPE plist PUBLIC \"-\/\/Apple\/\/DTD PLIST 1.0\/\/EN\" \"http:\/\/www.apple.com\/DTDs\/PropertyList-1.0.dtd\"&gt;\r\n&lt;plist version=\"1.0\"&gt;\r\n&lt;dict&gt;\r\n  &lt;key&gt;Label&lt;\/key&gt;\r\n  &lt;string&gt;com.companyname.ethernetmonitor&lt;\/string&gt;\r\n  &lt;key&gt;ProgramArguments&lt;\/key&gt;\r\n  &lt;array&gt;\r\n    &lt;string&gt;\/Library\/Scripts\/CompanyName\/turnOffAirport.sh&lt;\/string&gt;\r\n  &lt;\/array&gt;\r\n  &lt;key&gt;WatchPaths&lt;\/key&gt;\r\n  &lt;array&gt;\r\n    &lt;string&gt;\/Library\/Preferences\/SystemConfiguration&lt;\/string&gt;\r\n  &lt;\/array&gt;\r\n&lt;\/dict&gt;\r\n&lt;\/plist&gt;<\/pre>\n<p>This will watch the System Configurations folder for changes. This folder changes when you plug in a network cable, turn on AirPort, etc. When it changes, a script called turnOffAirport.sh, stored in \/Library\/Scripts, is run to see if the Ethernet connection has a company IP address:<br \/>\n#!\/bin\/sh<br \/>\nif ifconfig en0 | grep 155.144;<br \/>\nthen \/usr\/sbin\/networksetup -setairportpower off<br \/>\nelse<br \/>\nexit 0<br \/>\nfi<br \/>\nThis 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.<\/p>\n<hr \/>\n<p>I suspect that this can easily be made to work both ways&#8230;  At the present time, it appears to turn off the wireless, but not automatically turn it back on.<\/p>\n<p>That could be by design.  After all, the laptop will be consuming more power with wireless turned on&#8230;.  But, I believe by changing the exit 0, to <strong>\/usr\/sbin\/networksetup -setairportpower on<\/strong> would be enough to change the behavior&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From MacOSXHints&#8230; 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 class=\"read-more\" href=\"http:\/\/www.schollnick.net\/wordpress\/2010\/03\/disable-airport-when-ethernet-cable-is-connected\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[12,23,5,25],"tags":[141,192,135,115,91],"_links":{"self":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/posts\/2629"}],"collection":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/comments?post=2629"}],"version-history":[{"count":0,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/posts\/2629\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/media?parent=2629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/categories?post=2629"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.schollnick.net\/wordpress\/wp-json\/wp\/v2\/tags?post=2629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->