loading

Step 5: Write a function

Next we will write a function to actually do the backup.

function backup {
DEST=$1$2
SOURCE=$2
echo "Src : $SOURCE"
if [-d $DEST]
then
echo "Dest: $DEST"
else
mkdir -p $DEST
echo "Dest: $DEST -created"
OPTS="--force"
fi

#Perform backup
rdiff-backup -v2 --exclude-special-files $OPTS $SOURCE $DEST
#Cleanup version files older than 4weeks
rdiff-backup -v2 --remove-older-than 4W --force $DEST
#Print a report of what we backed up and cleaned up
rdiff-backup --list-changed-since 0D23h00m $DEST
}

Hey, this is a great instructable and is very informative. Just one thing is missing... pictures! It really helps a lot when trying to follow directions so you should consider taking some photographs. Once you do that and leave me a message when you have so that we can publish your work. Thanks! Thanks for the cool instructable and we hope to publish this soon!
Very good.
Very thorough!<br> Works a treat.

About This Instructable

7,070views

12favorites

License:

Bio: I like to tinker with just about anything, sometimes it works out in the end. Have fun looking at the projects, try tearing something open ... More »
More by joe:Intel Edison Garage Monitor and Alert System Intel Edison Fat Bike Tire Analyzer Intel Galileo Garage Monitor 
Add instructable to: