Wget Voodoo

Filed under: tinkering,webcam — jaydublu @ 1:09 pm

I’m stumped by a supposedly simple problem with using wget to regularly fetch a snapshot from a webcam over a not-too-reliable network connection to then push to a website. If the connection fails wget overwrites a good file with a 0 byte one – how can I get it to leave the original intact?

Here’s my script (simplified – mine actually fetches 4 images and writes to two ftp accounts):


# fetch images, store them locally
wget --user=#### --password=#### -O video2.jpg
# ... next images

# now push them to a webserver
ftp -in <<EOF
  open my.domain.co.uk
  user ##### #####
  put video2.jpg
# ... put other images

Ideas I’ve had but not been able to realise yet …

  1. Scour the wget manpage for some option to only overwite the output file if sucessful
  2. Get wget to output to a temp file, wrap in script testing filesize to overwite the ‘real’ file if filesize > 0 bytes
  3. Get wget to output to a temp file, wrap in script testing wget repose to overwite the ‘real’ file if response contains ‘saved’
  4. Somehow put logic in the ftp script to only upload files > 0 bytes

Proxying with Apache2 on Ubuntu

Filed under: tinkering,ubuntu,webcam — jaydublu @ 4:01 pm

Further to earlier problems with using Apache2 on Ubuntu to proxy web requests to devices inside my local network, I think I’ve now sussed it.

Specifically, I’m trying to get Apache to enable external access to a webcam inside my network, where for some reason I can’t enable access to it directly using my router.

I’m now relatively confident that the appropriate way to do it is to enable mod_proxy and mod_proxy_http with sudo a2enmod proxy_http, this then allows use of ProxyPass directive within a vhost for example:

ProxyPass /webcam

If you’re gonna put a webcam up a lighthouse …

Filed under: life,rants,webcam — jaydublu @ 8:46 am

… make sure you’ve got a friend.

If only someone had told me! The IP camera up the lighthouse plugs into a WiFi Access Point configured as a range extender, which through an external antenna connects to another Access Point with external antenna a mile away on my roof and into my home network giving internet connectivity to upload a picture every ten minutes.

But any tiny change I make to my home network (like changing subnet ranges 🙂 ) seems to break the link, and to fix it means lugging a laptop up the 112 steps of the lighthouse. And if you’ve missed something vital at the other end (like turning something on) it’s a long walk down, back home, back to the lighthouse, and all the way up to the top to try again.

I spent a whole afternoon trying to get things running again after (stupidly) trying to upgrade encryption from WEP to WPA. It doesn’t make sense that you can’t configure the wireless side of these these over a wireless connection!

So, yes, it would be so much easier if there was someone else (or another me?) at the other end with walky talky. 10-4?

I hate computers!

Filed under: rants,tinkering,webcam — jaydublu @ 6:25 pm

Probably unfortunate given what I do for a living, but there you go. Actually, I’ve always wondered if it’s a useful trait – I’m not usually a proponent of technology for technologies sake – if I can solve a problem without getting high-tech, that’s my preferred option.

I may just be feeling paranoid, but it seems that the bytes have been ganging up on me recently – I have a growing number of niggling problems that refuse to go away. The odd challenge can be quite enjoyable, as long as the implication of not fixing it is not too severe – but you soon start to realise how much we have grown to depend on email / google / multimap / skype and all the other trimmings when you can’t get them.

And worse, it almost makes me feel physically ill when I start to feel I’m not able to keep it all running – when things go wrong faster than I fix them; when the silicon is ruling me rather than vice versa. Is judgement day coming?

Having decided to give Vista a chance, how is it repaying me? My machine has started bluescreening two or three times a day at the most infuriating times (like when you’re blogging about it). I’m going to live with it for a bit longer rather than doing anything rash – ongoing.

The lighthouse webcam crashed earlier in the week – usually gets sorted by turning the power off then on again, but from inside the lantern there was no sign of life outside – meaning a second trip with more keys, tools etc. Turns out it was a blown fuse so nothing major – fixed.

I’ve replaced the firewall in my modem / router with a mini-ITX box running IPCop – the idea was to secure my network a bit better while allowing certain individuals more access to growing numbers of devices I’m hosting – but it absolutely refuses to let OpenVPN work as advertised, and I’ve loved that application when I’ve used it in the past – ongoing. While fiddling I did muck something up with the blue network meaning it wouldn’t grant dhcp leases to wireless devices – fixed (phew). Postscript – OpenVPN is now working perfectly – turned out it was a problem within the network and not with ipcop – zerina is a great plugin that makes managing OpenVPN a doddle.

My Acer easyStore NAS is pretty much up and running now, but I still have a niggle where every time I restart my laptop the backup application can’t then see the drive – you have to remove protection then re-protect to run a backup, meaning you have to do it manually every time – that wasn’t the idea but I haven’t been bored enough to try and get some more support after the last time – ongoing.

Do things like dodgy starter solenoids on my truck count as computer problems? Still adding to my irritation though – hopefully this week I’ll crack more issues than arise and get back to a tolerable level of ‘silicon rage’.

Of course I’m my own worst enemy – I will not leave well alone, and have to keep fiddling or trying to improve things. But the moral of this story (if there is one) – don’t let the machines grind you down!

Webcam working

Filed under: Happisburgh,tinkering,webcam — jaydublu @ 7:12 pm

I couldn’t bring myself to blog last week I was so cross – things were definitely not going my way and despite having top notch kit, a lovely day, plenty of time, and no excuses I couldn’t get the naffing new webcam to work up the Lighthouse.

Everything worked perfectly at home, I got all the external stuff mounted, all the wires routed and clipped. I turn it on and then run into problem after problem. The camera doesn’t seem to be working, I forgot to turn the new wireless rig in my roof on so I had to run back home to do that but still the Access Point couldn’t see any signal. All in all I was up and down those blasted stairs at least 10 times.

For a break then I take the old camera down to Cliff House and mount it in one of the front windows – at least something works. So I return to the Lighthouse and start eliminate issues one by one.

As the day was drawing in and it was starting to get dark – I had a breakthrough and discovered what was wrong – for 2 feet I had the network cable to the camera cable tied to the wifi coax running to the external antenna – there was only one route from inside the lantern to outside and all cables were using it.

If I turned the camera off, the access pooint started picking up signals, and vice-versa – I was suffering from cross-talk.

That discovery having been made I didn’t have enough time to fix the job but could I bodge it enough to work until my next opportunity to play? Almost – I made a silly mistake on network addressing for the camera that I didn’t notice until I got home, and trying to adjust subnets remotely I made another mistake and locked myself out of the repeater up the lighthouse.

Anyway, I get the key this afternoon and go up there all tooled up and feeling confident. Despite initial problems where nothing seemed to want to be playing ball, I worked through it methodically and suddenly I’d started getting pictures posted to the website – success! So I’m a happy bunny now.

For reference, the camera is now an Axis 211 in the Verso external housing kit (very tidy, but quite a costly setup) with a Linksys WAP54G access point at either end of the wireless link, each with external antennae (an 8dB Omni on the house and a 12dB directional up the Lighthouse). It appears I’ve got a good strong link between the two – fingers crossed it stays that way.

Happisburgh Webcam

Filed under: Happisburgh,tinkering,webcam — jaydublu @ 7:30 pm

I set up a webcam over a year ago mounted on Happisburgh Lighthouse looking at the end of Beach Road – it was a bit tricky because of the exposed location, and that there was no local Internet connection.

I bought a D-Link Wireless IP camera on eBay, put it in a cheap external housing with an external wifi antenna to make the 1 mile jump back to my house. I’m running a homebrew access point aounr an old Pentium II box, a Netgear 802.11b PCI card, and a stripped down OS called pebble with an extension to allow meshing – the original idea was to build a wireless network around the village to share a Satellite link before the days when we realised we would get Broadband.

So the setup works, but it’s a bit poor. Now something’s finally getting done at Happisburgh I thought I’d try and improve things, but I’ve got several hundred quid’s worth of gear invested already, without all the time I’ve had to put in, so I put an appeal out on the Happisburgh site for sponsors.

At this point I have to thank John Opie from www.woodstoves.co.uk and www.woodfuels.co.uk and Robert Ferguson for answering that appeal and giving me a budget for some proper gear. But life’s not that simple – it may be old gear but it’s a complex setup and it’s stable. I’ve got the entire new system working at home, but when I tried to start upgrading bits everything fell over.

Somehow, I’ve got to upgrade the whole lot in one go – and that’s going to take a bit of doing for one person. When you’re in controlled circumstances and you can tweak one variable at a time it’s quite easy to get things working. However, it’s a pain in the derrier to drive from home to the lighthouse, park, unlock, climb all the way to the top, tweak, find I need to tweak something at home so climb in and down, lock up, drive home …

If it was easy, would it be as much fun though?