Created
April 10, 2011 22:57
-
-
Save dberringer/912823 to your computer and use it in GitHub Desktop.
this is the launchctl plist file I used to run my .trackr script
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
#!/bin/bash | |
WIFISTAT=$(networksetup -getairportpower en1 | grep -o Off) | |
# this will turn on the wifi if need be and get the geolocaiton | |
# from CoreLocationCLI then turn the wifi back off if appropriate. | |
# CoreLocationCLIP seems to have a bug with -once where it pulls old gps | |
# data rather than the current data so I have to run it then kill it then | |
# run it with once to get the desired results. | |
if [ "$WIFISTAT" == "Off" ]; then | |
networksetup -setairportpower en1 on | |
sleep 10 | |
/Users/doug/.CoreLocationCLI & | |
sleep 5 | |
killall .CoreLocationCLI | |
GEOLOCATION=$(/Users/doug/.CoreLocationCLI -once) | |
networksetup -setairportpower en1 off | |
else | |
/Users/doug/.CoreLocationCLI & | |
sleep 5 | |
killall .CoreLocationCLI | |
GEOLOCATION=$(/Users/doug/.CoreLocationCLI -once) | |
fi | |
{ | |
echo -e "Current date & timestamp:" | |
date | |
# outputs lan and wan ip addresses to a file on dropbox. | |
echo -e "\nMy current external ip is:" | |
echo $(wget -q -O - http://www.whatismyip.com/automation/n09230945.asp) | |
echo -e "\nMy current internal ip info is:" | |
ifconfig | |
echo -e "\nMy geolocation:" | |
echo $GEOLOCATION | |
} > /Users/doug/Dropbox/Misc/location.log | |
# make sure you manually specify the key for scp so it will | |
# know what to use when it is running as a daemon. | |
scp -i /Users/xxxx/.ssh/id_rsa /Users/xxxx/Dropbox/Misc/location.log [email protected]:/location.txt |
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//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>com.dberringer.trackr</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/doug/.trackr.sh</string> | |
</array> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>StartInterval</key> | |
<integer>10800</integer> | |
</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
Current date & timestamp: | |
Thu Apr 14 16:03:40 PDT 2011 | |
My current external ip is: | |
xxx.xxx.xxx.xxx | |
My current internal ip info is: | |
"your ifconfig data" | |
My geolocation: | |
<+38.xxxxxxxx, -122.xxxxxxxx> +/- 166.00m (speed -1.00 mps / course -1.00) @ 2011-04-13 16:03:40 -0700 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment