If you can read this, the DNS changes have propogated and the site is being presented to you from the new VPS, not Gradwell, let me know if you see anything weird.
Tag Archives: linux
Cygwin and rsync and all things nice
I wrote a little while ago that I was running Linux (Ubuntu in this case) inside a VirtualBox virtual machine, and it was all good. Before that I’ve played with lots of methods of getting my favourite unix utilities (like rsync) working under Windows. I’ve used Cygwin, and pre-compiled Windows versions and stripped-down Cygwin versions, and second machines running Linux and VM’s.
One of the main drivers for getting those things working is to back up my websites, held on my hosting account. I can ssh into my hosting account, and that means if I can get rsync going locally, I can use it with ssh to copy all changes to my local machine. It’s efficient (rsync only copies changes) and it’s easy. The pain is always finding a decent compliant version of rsync.
Anyway, I already said that when I started using the Linux VM I ported my script across to that, and along with the VirtualBox shared folders, I could backup my websites and they were visible under XP. It wasn’t pretty but it worked, and it meant I had to start up the VM. At the start that wasn’t a problem because I was using it quite a bit but as the days went on and I stopped launching it, backups were less frequent.
And then today – random disaster. I crashed the VirtualBox VM image, and after a couple of restarts it eventually stopped booting. This wasn’t a great problem as I had snapshots of working images, so I just rolled back to one of those with two clicks. Two clicks which took less time than the following thought took to get from one end of my brain to the other ‘I made the snapshots weeks ago, and since then I’ve written a lot of scripts and downloaded a lot of files and you just erased them all you idiot’.
So, I set about repatching Ubuntu and setting up various settings that I’d lost and made a few more snapshots. But I needed a more permanent, reliable website backup solution.
Which means I’ve installed Cygwin again. I know there are Windows binaries for rsync, and I know there are other apps which claim to do the same thing, but you can’t (in my view) beat the simplicity of Cygwin and the unix binaries. Now I have a working cron daemon, ssh configured, rsync installed, and my little script which does all the work. The rsync command is pretty simple,
rsync –recursive –links –safe-links –rsh=ssh –stats –human-readable me@mywebhost:/myhomedir/ /path/to/local/copy/
Then I just tar up the resulting files, compress them, make sure the filename has a date in it, and I can be confident I’ve got copies of everything I need. Since most of my sites rely on mysql for their data, I also run some jobs on my webhost to mysqldump all the data into files three times a week, and I then back those files up locally. I could mysqldump the content remotely, but it’s a hell of a lot quicker to do it on their system, compress them, and then rsync the compressed files.
Installing ssmtp lets me send mail from the Cygwin command line, so the script can send me a mail when it’s finished, and I’ll schedule it in cron to run once a week or something. Much better.
Plus, I get all the fun of vi, grep and awk 🙂
Virtual Geekery – Sun xVM VirtualBox
Been playing with Sun’s xVM VirtualBox software again for a couple of days. I find virtual machines fascinating. Clearly emulators have been around since the dawn of computing, and in fact, the whole concept of writing software is in some ways emulation. But the complexity of emulating an entire PC, within a PC, just makes me giggle.
In the daylight hours that I’m obliged to work I spend a lot of time dealing with virtualisation as it’s an increasingly popular technology, and I’ve messed around with virtual machines at home, but VirtualBox really is pretty smooth.
And I’m using it to satisfy my other geekery interest – Linux. Anyone unlucky enough to have read this blog for a few years will know that I used to have much more Linux in the house, handling web, mail and a bunch of other things. Over time it became clear that I was just doing it for the sake of it and that open source and free Windows software really was enough to get me by. This was even more true when we bought new PC’s with XP licenses (I’ll leave that statement hanging, so you get the implication).
I’d messed with Linux desktops for quite a while, originally with SUSE and a little Red Hat, but I’d never gotten on very well with the X Windows environment, it was always too painful to me. So for a long time I stuck to a server implementation of Debian (never got X working on the graphics card that I used in that machine) and stuck to the server side. Lately however the desktop distributions have come on in leaps and bounds and coupled with Linux versions of Firefox and Open Office, they really do provide a significant amount of functionality that I use day to day at home.
So I stuck Ubuntu on a virtual machine and it runs really well, very impressed. Despite the fact that it’s a VM it runs pretty quickly, more than useable. I suspect other than games I could quite easily live with Ubuntu as my main OS and these days WINE is pretty good at supporting most games (if I understand it correctly). The reason I won’t move fully is that I have a legit version of XP on this machine, it works fine, does everything I need it to do and plays games. Which is exactly why Linux is still the underdog in the desktop wars and why you find people so upset about the bundling of OS’s with hardware.
The reason I started looking at VirtualBox again was actually nothing to do with Linux, I wanted to see if I could build a little sandbox running XP, in which I could install and run software that I’d downloaded to make sure it worked as expected and didn’t cause any issues, before installing it on the real image. VirtualBox provides really nice snapshotting which can ‘roll back’ any malicious installs. I’m really not sure how the XP licensing works though. Can I run the same licensed version of XP on my machine, and inside a VM on the same machine legitimately?
CD Player
I wanted this 300 CD Changer from Sony, but it appears to have been discontinued. Which is a shame. They do a 400 CD one, but it’s £100-200 more, although it does play MP3’s.
So we’ve looked at some 5 tray ones, but at £40 less than the 300 CD changer was going to be, we feel shortchanged.
In the meantime, because our CD player isn’t working properly, we’ve been playing MP3’s. And it’s not bad.
So, I’ve got this Linux box running Debian. PII-400 which holds together our mail, news, web stuff here. And it’s got a 40 Speed CD ROM in it, and a reasonable sound card. A plan is hatched, convert it into a CD Jukebox so that we don’t need a new cd player.
Quick check on freshmeat and I have some candidates for web-controllable jukebox software.
Got home, whacked a CD into the drive, lots of clicking but no action. So, cd drive is dead. Ack! Spend an hour convincing myself of this fact by trying lots of things, including moving the drive from slave to master, etc. Also, since it’s Linux and I can’t remember when I last played anything in the cd drive, I play with modules and configs for a bit. No joy.
Luckily I have spares, drag out a 24 speed drive, rip the linux box apart, whack in the new drive, test out some CD’s, looks fine. Bundle the thing back together, take the time to do a bit of recabling I’ve been meaning to do for ages, and stick it back onto the shelf.
Then it’s a software hunt. Debian has jack (manager), cdparanoia (cd ripper) and mpg321 (player) available as packages. I found a debian package of bladeenc knocking around (encoder), and I’ve downloaded gronk (jukebox type web app). Currently ripping our copy of Puddle of Mud’s album.
Haven’t got the jukebox stuff in yet.
So, need to install that software, or choose another one, and then consider relocating the speakers and amp.