Selective Backup script using rsync

From Admin-SIG

This is no commercial, heavyweight tool, but I was looking for a simple way to inentify the really IMPORTANT stuff, that I may want to back-up to an off-site location.

This assumes you already have an rsync system set up for backup.

I have a script with an include only list of stuff to back up. If it is not explicitly on the list, it is not backed up.

The backup list tree is identified with .backupList files. Start with one in / that identifies which root-level directories are to be backed up.

/.backupList

etc
home
var

I want all of etc, so I do nothing more. For places like var especially there are only a few things I want.

In /var I have another .backupList file to restrict the backup to only a few sub-folders:

spool/cron
www

I want all of my WWW pages, so I leave www alone. However, all I want is my cron jobs from spool.

Now, I have a happy script that recursively searches these .backupList files, and pushes only the indicated files and folders to the backup server.

Exclude directives

Some areas, like user accounts, have stuff we do NOT want to back up. In folders on the backup tree, you may include a .backupExclude file, which has patterns of files and directories to skip. My .backupExclude contains:

cache
Cache
tmp
.Trash
Trash
Junk
.beagle
Inbox.*summary
*.index
*.index.data
Deleted?Messages
Drafts
.gconf
.gconfd
.gimp-2.2
.gnome*
.gstreamer*
.gtk*
XUL.mfasl
history.dat
.thumbnails
.wapi
INBOX.Trash
Office??

See the Recursive rsync backup script perl source. Its not very long (or hard).

Usage

My backup command is

/etc/coreBackup.pl earwig::raven /

to backup this machine to a volume called raven on backup host earwig.