Location-aware Macbook Settings • Andrew J. Freyer

Wednesday

Want to log a history of your locations?

It's REALLY easy with shell scripts!

Copy this shell script into Text Editor:


#!/bin/bash

echo $(date) $(defaults read com.andrewjfreyer.AirportLocation CurrentLocation) >> LocationLog.txt

Save it as "LogLocations.sh"

Then, add a Shell Script to a Snapshot.

sh /Path/to/LogLocations.sh

Then you will have your locations logged, with a timestamp!

5 comments:

  1. Awesome! Thanks!

    ReplyDelete
  2. Curious...

    Could this script be adjusted to save a log file to a Dropbox folder and therefore give you an indication of where your computer was if ever it got stolen? (Assuming the thief opens the computer to use it rather than completely wiping the drive clean first).

    ReplyDelete
  3. Sure!

    Just change the ">> LocationLog.txt" part of the shell script to:

    "/Path/To/Dropbox/LocationLog.txt"

    make sure to enclose it in quotes!

    ReplyDelete
  4. Also, in 0.5083 (mid-May probably) I'm adding a location log iCal calendar. It'll show you where you've been and for how long!

    ReplyDelete
  5. Awesome! Thanks for the quick response.

    ReplyDelete