Simple Bash Backup v.01

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

4 Responses to “Simple Bash Backup v.01”

  1. wezzul Says:

    I have one that does incremental backups using rsync. Has 8 directories per server, one for each day of the week, and one that is “current”.

    I can send it to you or post it here if you like…

    WEZ

  2. Shelby Says:

    You ever going to get me that script?

Trackbacks

  1. University Update - Linux - Simple Bash Backup v.01
  2. Cell Phones Tracer
Share on del.icio.us digg

Leave a Reply