Backing Up

I was looking at my old domain on the Internet Archive at lunchtime today and got a bit nostalgic. I have my old server that I bought from Computastore back in 2001 in my spare room it is an old e-machine and it served me well. However around 2006 I suffered a huge database crash and yup – never backed up :( It now only exists in that archive which is a real shame. Maybe if I have enough time I might screen scrape it – but even then it wont be exactly the same and it is an awful lot of effort. I have the old e-machine in my spare room, its just sitting there with no power to it. I didn’t really do much back then (2006-2007) – I have the old tvlistings site but that isn’t up to much. I never backed up my mail either.. Shame shame shame. So I have to get some sort of backup strategy going for my new server as long as it works. While watching The Apprentice I came up with the following solution. Basically using my dropbox account. I toyed with the idea of using Gmail by emailing archives – mainly because searching the archive would be dead easy and it would store. However emailing the data over wouldn’t be brilliant – its not really a long term option. I know my solution is only for personal use but that’s probably too dodgy. So dropbox it is. My first port of call was the usual – the oul faithful CPAN and found Net::Dropbox::API. It might have done what I wanted – but I searched googled ‘dropbox linux’ and found this. As usual here is a copy of the .bash_history from this session.
sudo yum install dropbox.x86_64
vim /etc/sysconfig/dropbox
sudo /etc/init.d/dropbox start
Once you install dropbox it will complain that this machine isn’t linked to a drop box account and give you a URL to paste in and link. When it does it will take your home directory and create a Dropbox/ directory. You can move the directory to wherever you want you can. I didn’t. It will also complain about not having Nautilus at the first – its been 30mins so far and it hasn’t complained after the initial one. I then wrote a dirty bash script to backup my websites and the mysql databases. No doubt there will be more added to it such as postgres databases when I start to use them. This is just my first dirty attempt and it works. I probably need to tar up my mysql databases – but for the time being it will do.
#!/bin/sh -f

rsync -a /www/ /home/swm/Dropbox/backups/www

mysqlhotcopy db1 /home/swm/Dropbox/backups/db/db1 -u xxx -p xxx --keepold
mysqlhotcopy db2 /home/swm/Dropbox/backups/db/db2 -u xxx -p xxx --keepold
Runs every night.
  • Server (14)