I wrote two small scripts to control the power status of the mac airport.
- Power cycle the airport
#/bin/bash
# This script does a power cycle of the airport
# Pedro Parracho <pedro.parracho@gmail.com>
/usr/sbin/networksetup -setairportpower airport OFF
/usr/sbin/networksetup -setairportpower airport ON
- Toggle the power status
#/bin/bash
# This script toogles the power status of the airport
# Pedro Parracho <pedro.parracho@gmail.com>
airportPower=$(/usr/sbin/networksetup -getairportpower airport| cut -d' ' -f4 | tr '[:lower:]' '[:upper:]')
if [ $airportPower = "ON" ]
then
echo airport is ON, turning it OFF
/usr/sbin/networksetup -setairportpower airport OFF
else
echo airport is OFF, turning it ON
/usr/sbin/networksetup -setairportpower airport ON
fi
No comments :
Post a Comment