The relevant portion of the log-location-to-notifo.sh script was this: # Build a URL that will display a Google Maps page with useful info Notifo lets us attach a URL to a notification, so we can create a Google Maps URL with the information we have discovered so far. # message is coming from command line arguments or from STDIN. # Change command line to curl depending on whether the NOTIFO_API_KEY=baf06f567ee7e30bc5ab5760b48ab748e7e30bcd3Įcho "Usage: $0 "Įcho " -l label The application sending the message"Įcho " -t title The title of the message"Įcho " -u url The URL to take the user for more information"Įcho " message The message to display to the user or STDIN if not supplied"Įcho "Example: $0 -l Log -t "Access Granted" A user has logged into your system." You’ll need to sign up and insert your own account and key in the notify.sh script: #!/bin/sh The relevant part of the shell script is this:ĮRR=$(echo $LOCATION | sed 's/ (+/- *) (.*/3/' ) Step 4: NotifoĪnother handy script that’s used within log-location-to-notifo.sh is notifo.sh which posts notifications to your account. The log-location-to-notifo.sh file looks like this (sorry about the long lines): #!/bin/sh I used the sample rc.* files provided and added a line to rc.wakeup: /usr/local/bin/log-location-to-notifo.sh Step 2: Shell Script I used the example files included in the distribution and made a file at /Library/LaunchAgents/de. ?xml version="1.0" encoding="UTF-8"?> is unplugged from a power supply (laptop).is plugged in to a power supply (laptop).display is undimmed without having gone to sleep.is put to sleep (must run for less than 15 seconds).According to the man page, the following events can be used as triggers. (You might be imagining a possible problem here discussed below) Step 1: SleepWatcherįirst we need the ability to run a script when the laptop wakes up, and the SleepWatcher tool is a great way to run commands when certain events happen. If you don’t have a password prompt, then suspect helpfully connects your computer to a network in order to use it, and you get notified. If laptop is still connected to a known wireless network, or if Third Party has plugged in a network cable, laptop determines its latitude and longitude and sends notification. Third party sees password prompt (you have that turned on, right?) and wonders. Third party opens laptop to snoop or legitimately try to identify owner. Google Maps: Displaying your laptop location.Notifo: Lightweight notification for iPhones, etc.LocateMe: Free command line tool (from me) using Apple’s geolocating API.SleepWatcher: Executes commands of your choice when computer wakes, sleeps, etc.Using a few free tools and shell scripts, I cobbled together my own LoJack-type system that notifies me whenever my laptop awakes (I can’t help you if your computer is turned off). There are commercial services to help you locate lost laptops, but I wanted a feature that required less software to be installed and fewer Big Brothers helping me out along the way.
0 Comments
Leave a Reply. |