I was slightly surprised to find that it’s over four years since I mentioned Evocam, which for those of you who don’t like to click links, is the software I use to serve up the webcam images from the occasionally live Lescam and the usually live except when I forget Tiggercam. Like any good piece of software, Evocam has done what it’s supposed to do and generally behaved well.
But there was a slight problem. I like to have the webcam upload a static image periodically, so that when it’s not running, there will be a moderately recent image rather than one from 2009 or thereabouts. Now the old version allowed me to use secure FTP to do this, which is the only way my web server will allow it, but the new version for reasons that quite honestly don’t make any sense at all, does not have an SFTP option, just plain old let’s send our passwords in plain text FTP. Now that may be added in a future update, which would be good, but as it is, the software won’t quite do what I want.
Added to this was the fact that I’d like to have my server accessible only by SSH key authentication, and even the old version didn’t support this.
So, yesterday afternoon, I had a bit of a think. I knew Evocam could be set to save an image to a local folder on a regular basis. Could I find a way to get some software to upload this image automatically? Well, I looked around a bit and found one or two things that looked like they might do the job but were a bit expensive. Then a bit more searching reminded me about Automator. That’s a OS X utility that basically lets you create scripts or even applications that will run when things happen on your computer. It’s nothing that a real programmer or scripting person couldn’t do for themselves, but for people who don’t have the ability to do that, it’s great. And one type of thing you can set up is called a Folder Action. This will monitor a folder for you, and when a file is saved, it can carry out an action for you. There are loads of options available, and there are loads of add-ons you can find on the internet to add more functions.
I did find an “Upload to FTP” add-on, but that seemed to insist on using passwords, so I used the option to run a shell script. All this needed to do was run the command to do a secure upload of the image and delete the local copy:
scp path-to-file/lescam.jpg email@example.com:/path-to-folder/webcam rm /path-to-file/lescam.jpg
 As far as I understand it, it serves a continuous sequence of JPG images when you call the webam.mjpg file
 My system administrator is quite insistent about that sort of thing
 This is pretty cool, actually – you create a public and private key pair on any computer you want to use to manage your server, upload the public key and add it to a file that tells the server how to connect. You can then log on to the server without sending your password over the internet.
 On OS X and Linux, this is built in, on Windows you’ll need a tool such as PuTTY