Hints for Security
Keychain Access From Shell
It OS X it is possible to access the Keychain from shell using security. This makes it possible to avoid having your passwords visible in shell commands that normally require a password in the command. See:Keychain Access From Shell
Wakelog Pictures
This page describes how to set up your iSight enabled Mac to take and upload pictures on wake.
Download isightcapture and place the executable in /usr/bin/.
Download sleepwatcher and run both installers. Sleepwatcher is a dæmon. When the computer wakes, it iterates through all user accounts and checks for a .wakeup file in their home folder. If .wakeup is found, it runs it as that user
Make sure you have password-less uploads setup for a ssh server via shared RSA keys. On that same computer create a directory for the images to be uploaded to.
Create the following file called ~/.wakeup and make sure it is executable (chmod +x ~/.wakeup).
#!/bin/bash
LOG_FILE=~/.capture/WAKELOG
date=`date +%Y%m%d_%H%M%S`;
echo `whoami` woke at $date >> $LOG_FILE;
date=~/.capture/queue/$date.jpeg;
# wait a bit
sleep 1;
# capture an image
isightcapture $date;
# wait a while
sleep 60;
# check for internet connectivity
online=`curl example.com | wc | awk '{print $1}'`
if [ $online -ne 0 ]; then
# attempt to upload images
echo attempting to upload images >> $LOG_FILE;
# change the following two lines as needed
scp ~/.capture/queue/*.jpeg user@example.com:~/wakepics/;
scp $LOG_FILE user@example.com:~/wakepics/;
mv ~/.capture/queue/*.jpeg ~/.capture/uploaded/
else
# no connection found
echo no connection found >> $LOG_FILE;
fi
