OSX sleepwatcher script to take a photo on wakeup and upload to dropbox
-
install Dropbox-Uploader
-
install imagesnap
$ brew install imagesnap
-
install sleepwatcher
$ brew install sleepwatcher
-
Drop the
.wakeup
file in your home dir
#!/bin/bash | |
# | |
# Mac camera auto upload script | |
# | |
##################################################### | |
# Generate filename based on date stamp | |
FILE_SRC=/tmp/$(date +%m%d%y%H%M%S).jpg; | |
DROPBOX_FOLDER=macbook | |
DROPBOX_UPLOADER=/Users/<username>/Dropbox-Uploader/dropbox_uploader.sh | |
# Take iSight Photo and store in /tmp with datestamp filename | |
/usr/local/bin/imagesnap -q $FILE_SRC; | |
# Wait a little while, if Mac is waking from sleep, needs a moment to connect to network | |
sleep 60; | |
# Generate semaphore for connectivity by pinging NASA | |
isconnected=$(ping -c 1 www.nasa.gov | grep 64 | wc | awk '{print $1}'); | |
# If connected... | |
if [ "$isconnected" -eq "1" ]; then | |
for f in /tmp/*jpg; | |
do | |
$DROPBOX_UPLOADER upload $f $DROPBOX_FOLDER; | |
rm $f; | |
done | |
else | |
# If not connected.. leave captures there until next time. | |
echo "No Connection, Image not transferred or deleted."; | |
fi |
OSX sleepwatcher script to take a photo on wakeup and upload to dropbox
install Dropbox-Uploader
install imagesnap
$ brew install imagesnap
install sleepwatcher
$ brew install sleepwatcher
Drop the .wakeup
file in your home dir
After $ brew install sleepwatcher
Just edit the file /etc/rc.wakeup to write your own wakeup command.
That's all, it should do the trick.
Doesn't work, did it step by step. Any help?