Posts Tagged ‘external’

Backup your data with cron, rsync and lftp

Thursday, February 12th, 2009

This post will explain how I do my backups.

In case my crontab should be deleted or lost, I have the script in an own file. Like in my code-nippets.

My computer is only used by me so I only need to backup my home-dir, where I save everything. /dev/sda5 is mounted to /home.

This script backups my home directory to one of my external harddrives, as long as the backup dir on the disk hasn’t been edited the last day and rsync is not running. Off course, rsync could run in other situations, but I don’t want to run two rsync’s at once and is therefore added as a case. It would probably consume all the bandwidth on my laptop when running two rsyncs on my slow 5400rpm harddrive.

if [ -d "/media/WD Elements/backup/" ] && [ -z "`ps --no-heading -C rsync`" ] && [ "`ls -ld /media/WD\ Elements/backup | awk '{print $6}'`" != "`date '+%Y-%m-%d'`" ];
then
rsync -au --force --delete-during /home/vegard/. /media/WD\ Elements/backup;
fi

Code above is from “/home/vegard/Linux/backup.sh” which runs every 5 min, using crontab. Use `crontab -e` to insert your cron-rule.

*/5 * * * * /bin/bash /home/vegard/Linux/backup.sh

Keeping backup of your webhotel is also important, and since I’m allowed ssh access to mine I can use sftp to download my files.

In “/home/vegard/Linux/sftp.sh” i have:
lftp -e "mirror . /home/vegard/Backup/hammerseth.com/" sftp://<user>@<host>/path

For the password, you can use ssh-keyrigs or if you dare sftp://<user>:<passwd>@<host>/path

The file above is run each sunday at 18:00 with this cron-rule
0 18 * * 0 /bin/bash /home/vegard/Linux/sftp.sh

I should also mention that I’m using a wordpress-plugin called WordPress Database Backup which mails all my database tables to my email, every week. Quite handy.

Be safe.

External LaCie harddrive and KINGSTON USB-stick

Wednesday, December 3rd, 2008

I got my package from Datakjeden today. I put my order up on sunday so the handling and shipment has been great.

The disk looks pretty awesome, like glas and has the same elegance as an iPhone. Unfortunately the blue light is blinking when the disk is working. I wouldn’t mind if it was still during usage. Something other that bothers me is the noise, it produce some ugly noises, but was really expecting. Partition tables on is another chapter, you can view it on the image in my gallery below.

KINGSTON 8GB DataTraveler works awesome, it’s fast enough and work like it should despite it’s plastic-feel. All in all is the devices great for it’s prices and I wouldn’t hesitate to buy them again.

LACIE disk and KINGSTON datatraveler