I think this kind of thing is pretty awesome. Take a picture from your iSight. Take a screencapture. Upload them both to a remote server. WHY DOESN’T EVERYONE WANT TO DO THIS?! Maybe you do, now you can (hopefully).
Firstly, props to Dylan O’Donnell, who wrote the original script. I was personally unsatisfied with FTP because it’s insecure and I always run into technical troubles with it. Probably because I never took the time to learn what I was doing with FTP via command line… But I favor SCP for my file transferring needs.
I also added a screen cap functionality because there’s all kinds of cool things you can do with that down the line. Time-lapse animation, security, you name it!
If you want the iSight captures to work you must download and install isightcapture! I’ve installed it to /usr/sbin/ and hardcoded the script to look there. If you don’t know what you’re doing, I suggest you do the same.
“Installing” isightcapture (assuming it’s unzipped and on your desktop):
Quick rundown of what’s happening here:
- Grab the date and time info and prepare the filenames (YearMonthDayHourMinuteSecond)
- Take a picture with the iSight, save it to a folder (~/Documents/pics/)
- Take a screencap, save it to the same folder (~/Documents/pics/)
- Resize all of the jpgs in the pics folder so they’re no more than 800px in any dimention
- Check to see if the computer has a network connection, if it does upload the files to a remote server (via scp) and delete the local images. If there’s no connection, do nothing (images will try to upload next time the script is run)
In order for this to work you must have SSH Keys setup with the server you are connecting to. If you don’t it will not work. If you google “ssh keys” there are a million ways to do it but this is the site that actually got it working on my modern mac: http://www.webficient.com/2007/11/16/mac-and-ssh-keys
Here’s a quick and dirty run down of how to do that, but I’m just copying from Phil’s post so don’t blame me if it doesn’t work for you :)
Generate the ssh key (obviously replace the CAPS stuff with your info). When asked for a passphrase just hit enter, this will make an empty passphrase which, I admit, is very insecure but it’s better than nothing and the script won’t work with a passphrase :( :
If you’ve never used SSH to make an outgoing connect on the machine you are connecting to you will also need to create the ssh folder on that machine and make it so only your user can read it:
Now copy your public key (id_rsa.pub) to the server you’re connecting to (I always name the copy on the server “temp_pub_key” so I know exactly what file I need):
Now connect to the remote server and navigate to ~/.ssh/
On the server, check to see if the file “authorized_keys” exists, if it doesn’t rename your “temp_pub_key” to “authorized_keys:
If “authorized_keys” already exists then you want to add your public key to the end of the file:
If “authorized_keys” didn’t already exists, you’ll also have to set the permissions of the authorized_keys file:
Here is the automation script originally written by Dylan O’Donnell with my tweaks and editing for SSH and screencaps.
trackback URL for this post: http://lab.joelgillman.com/archives/130_isightcapture-now-with-more-ssh/trackback
© 2010 jgillman -¦- Go WordPress! -¦- RSS 2.0 Feed
Post a Comment