Webcam update

I’m leaving this up for purposes of amusement. Since I downloaded  Evocam 4.1 and spent time and brain cells setting all this up, version 4.1.1 has been released. And guess what? It has the SFTP option! And guess what? If you don’t enter a password, it happily authenticates with my SSH key. So ignore all this nonsense, it’s no longer even slightly necessary.

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.

So, when I saw that there was a newer version with more fancy bits on it, I decided to pay the small charge to upgrade. First impressions were good – a generally simpler and easier to manage interface, and a better way of serving up the live image, using motion JPEG[1] rather than any nasty Java, page reloads, or indeed my old bit of JavaScript.

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[2], 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[4], 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 user@servername.xx:/path-to-folder/webcam
rm /path-to-file/lescam.jpg

And that worked. So when the Lescam is running, it ‘s being served quite nicely by the new version of Evocam, which means it shouldn’t lead to JavaScript memory leaks of the kind I’ve seen occasionally.

[1] As far as I understand it, it serves a continuous sequence of JPG images when you call the webam.mjpg file
[2] My system administrator[3] is quite insistent about that sort of thing
[3] Me
[4] This is pretty cool, actually – you create a public and private key pair[5] 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.
[5] On OS X and Linux, this is built in, on Windows you’ll need a tool such as PuTTY