Foi assim que eu fiz no Lion OSX. Qualquer coisa que possa ser melhorada?
#!/usr/bin/env bash
set -o nounset -o pipefail
WIFI_NAME="MyWifiName"
while [[ 1 ]]; do
SSID_NAME="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | sed -e "s/^ *SSID: //p" -e d)"
if [[ $SSID_NAME != $WIFI_NAME ]] ; then
TRANSMISSION="$(ps aux | grep Transmission | grep -v "grep" | head -n1 | awk '{print $2}')"
if [[ $TRANSMISSION != "" ]]; then
kill -9 $TRANSMISSION
fi
fi
concluído