Mac OS X: Close the airport in the script
This was the first issue. I am working on a system recovery strategy for a company's system image files. One of the requirements is that the company needs to turn off the airport on desktop, enable or disable airports in your notebook. There is a reason for this in the company environment. First, both wired and wireless networks are used to occupy the IP resources allocated by DHCP. Moreover, for wireless connections that are currently in short supply, these idle wireless connections are even more unacceptable. If you can use wireless connections at will, it is very likely that you will be connected to other external networks, leading to security risks.
These requirements are well implemented in Apple's Gui. One of the following two methods can be used to easily turn the airport off ),
Here, the option to prohibit normal users from changing airports is shown in Mac OS X 10.5 leopard. More detailed options are provided in 10.6 snow leopard:
These settings can be well solved when there are not many Mac machines in small companies. If there are hundreds of thousands or even one platform, the Administrator will not be exhausted. Smart users may make two image files, which correspond to different situations. However, the maintenance and upgrade work will increase in the future, and there will be many similar requirements, it is impossible to create an image file for a combination in each case. Therefore, using program settings is the right path.
If you are familiar with Mac commands, you can use networksetup to turn off airport power = equivalent to turn off. The command is as follows:
Networksetup-setairportpower on | off
However, the problem is that it can be closed but cannot remember the status. The previous status will be returned after the next restart.
To make the system remember the status, you must set powerenabled in preferences in systemconfiguration to the corresponding value and set requireadmin to true. See:
Here, the specific script is omitted and can be written by friends.
Copyright information
:
In line with the principle of open exchange, you are welcome to reprint, unless you explicitly declare "decline" and other words.
All articles, images, and codes (except for reprinting and translation) are copyrighted by the author of the article.
.
Reprinted in accordance with the following rules:
1) maintain the integrity of the article;
2) It cannot be for profit purposes; 3) the author of the entire article [Tony Liu @
China Online Education
] And all copyright information in the article.
For other matters, such as commercial purposes or profit-making purposes, or some reprinting, please contact the author:
TonyLiu2CA@yahoo.com
Further:
In fact, this problem can be solved in a better way to form an adaptive system, that is, to automatically detect the network status of the system. If the Ethernet connection is successful, the airport will be automatically disabled, otherwise, the system automatically opens the airport, and this solution will be more perfect.
At present, a feasible solution is to use the launchd daemons to automatically run scripts in the system, detect the en0 status, and control the airport status with the above scripts. The specific scripts and documents are also omitted here.
Tony Liu
June 18,201 0