rsync Backup Scripts

Olate

Active Member
Aug 1, 2003
42
0
156
I thought I'd share my rsync backup scripts with everyone. These can be set to run via cron at any time you wish and the output will be e-mailed to you.

Entire Filesystem

Code:
#
# Daily rsync backup script of entire filesystem onto /backup
#
# Last Edited: 8th December 2003 by David Mytton
#

echo
echo "***Daily rsync Backup***";
echo
echo "$(date +%d-%m-%Y)";
echo
echo "Progress:";
echo
echo "- Backing up / to /backup/latest";
echo
echo "Starting " $(date);
echo

rsync --archive --verbose --stats --delete --exclude /backup --exclude fstab / $

echo
echo "Completed " $(date);
All Databases

Code:
#
# Hourly rsync backup script of MySQL databases onto /backup
#
# Last Edited: 13th December 2003 by David Mytton
#

echo
echo "***Hourly rsync Backup***";
echo
echo "$(date +%d-%m-%Y)";
echo
echo "Progress:";
echo
echo "- Backing up /var/lib/mysql to /backup/latest";
echo
echo "Starting " $(date);
echo

rsync --archive --verbose --stats --delete /var/lib/mysql /backup/latest/

echo
echo "Completed " $(date);
Home Directories

Code:
#
# Hourly rsync backup script of /home onto /backup
#
# Last Edited: 8th December 2003 by David Mytton
#

echo
echo "***Hourly rsync Backup***";
echo
echo "$(date +%d-%m-%Y)";
echo
echo "Progress:";
echo
echo "- Backing up /home to /backup/latest";
echo
echo "Starting " $(date);
echo

rsync --archive --verbose --stats --delete /home /backup/latest/

echo
echo "Completed " $(date);
 

fuzzie

Well-Known Member
Oct 12, 2002
129
0
166
Very nice!
Can you help with backing it up to a remote server.
I have looked at the man rsync, and am a little confused.

I think it should be
rsync -azxWu -e ssh <src IPxxx.xxx.xxx.xxx> <remote IP xxx.xxx.xxx.xxx>:<dst>

What is <dst>?
 

dysk

Well-Known Member
Apr 22, 2003
52
0
156
Hi-
You all should look at rsnapshot. It allows incremental backups, by using hard links. This way you can use the standard filesstem tools to restore files, and you don't take up a ton of disk space.
See http://www.rsnapshot.org/ for more info.

Regards,
Erek Dyskant
Unix Consultant
 

[email protected]

Well-Known Member
Mar 5, 2002
487
0
316
Los Angeles California
Thanks for the useful script