JB's Homepage

One man on one island.

MyBook backups with Rsnapshot and some bash trickey

Comments

I had a client accidentally purchase half a dozen 500GB MyBook’s instead of the simpler cheaper USB models.

Since this site is remote from me it took a little while to deduce what was going on since the MyBook’s don’t act as USB drives and hence don’t appear as a USB device to linux.

User: ‘Yes, I’ve plugged it in! Yes it’s using the white cable!’
Me: ‘So… what exactly does it say on the box what drive it is…’

Anyhow, after figuring out that is was a MyBook I implemented ssh access using Martin Hinner’s clever hack and found a nice website of various MyBook Hack’s.

I was originally using the venerable Rdiff-backup, but alas couldn’t see it in the Optware packages. So I implemented a Rsnapshot solution, the only problem was I wanted some notifications from the MyBook devices to check that the backups were working, and so a simple bash script was in order…

#!/bin/bash
mailto=my@emailaddress.com,clients@theclientsdomain.com
time=$1
if /opt/bin/rsnapshot $time > /tmp/rsnapshot.log 2> /tmp/rsnapshot.logthen   subject='Backup success'else   subject='Backup FAILURE'ficat /tmp/rsnapshot.log | /opt/bin/nail -r admin@theclientsdomain.com -s "$subject" $mailto

Written by JB Hewitt

June 20th, 2008 at 12:13 pm

Posted in Code,Linux

 
close Reblog this comment
blog comments powered by Disqus