Created
February 1, 2012 20:59
-
-
Save derrickj/1719289 to your computer and use it in GitHub Desktop.
Quit torrenting when away from home
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN | |
http://www.apple.com/DTDs/PropertyList-1.0.dtd > | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>some-unique-label</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>osascript</string> | |
<string>path/to/quitTransmissionIfAwayFromHome.scpt</string> | |
</array> | |
<key>KeepAlive</key> | |
<true/> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repeat -- loop forever, polling wifi connection | |
delay 20 | |
set currentSSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --getinfo | grep ' SSID: ' | cut -c 18-" | |
if currentSSID is not "TheseAintTheSameKind" then | |
tell application "Transmission" to quit | |
end if | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.scpt
file to use your own WIFI name, and place it in~/Library/Scripts/
folder..plist
file, change/path/to/quitTransmissionIfAwayFromHome.scpt
to the location of where you put the.scpt
file.plist
in~/Library/LaunchAgents
launchctl load </path/to/plist>
or just restart your computer.