Posts Tagged ‘rsync’

Simple Bash Backup v.01

Saturday, August 11th, 2007

I needed a simple backup script to rsync some files from one folder to a mounted backup drive. After poking around on the net I found a few different scripts that I hacked together to make this script. I plan on updating it to send either Growl notices to my powerbook or send some popups to my Gnome desktop. Anyways here is the script keep checking back for updates.

#!/bin/bash
# Location of the backup mount
BACKUPHD=‘/bkmnt2′
# Directory to Backup
BACKUPHD1=‘/home/user/’

backup() {
echo -e "Using Rsync to copy file to $BACKUPHD\n"
rsync -azrup $BACKUPHD1 $BACKUPHD
}

if grep $BACKUPHD /etc/mtab
then
backup
exit 0
else
echo "Backup Drive was is not mounted. Attempting to mount… "
if mount $BACKUPHD
then
echo -e "Success!\n"
backup
exit 0
else
echo -e "Failed!\n"
exit 1
fi
fi
exit 0

rysnc is the best

Thursday, May 11th, 2006

Thanks to Jake for giving me this command it is now a LOT easier to sync my music from my laptop to my desktop

rsync -aruvpe ssh * shelby@192.168.1.2:/mnt/share1/music/

Since I make all the changes on my laptop everything stays up to date on the desktop.