http://www.linuxplanet.com/linuxplanet/reviews/6437/1

Back to article

Linux Backups For Real People, Part 3

Simple Network Backups

November 15, 2007

In part 1 of this series we learned how to format USB storage devices for maximum portability, and how to configure udev so they would always have the same names when you plug them in, and in part 2 we learned a simple, efficient way to use the excellent rsync command for easy single-user backups.

Today we're going to create menu icons for launching our backups whenever we darned well feel like it, set up a simple network backup scheme, and create automatic scheduled backups.

First we'll take our rsync incantation from last week and enshrine it in a shell script, and give it an imaginative name like, oh, what about backupscript:

#!/bin/sh
##################################
# simple rsync script for making backups
# to a USB storage device, formatted in
# FAT16/32
##################################
# this must be one long unbroken line
rsync -rlvt --modify-window=1 --include-from=/home/carla/rsync-includes \
/home/carla/* /media/BACKUP1

If you are having trouble using include and exclude files, there is a simpler way: just list all the files and directories you want to backup like this:

rsync -rlvt --modify-window=1 \
/home/carla/thisdirectory \
/home/carla/thatdirectory \
/home/carla/filename \
/media/BACKUP1

You don't have to list them one per line; that's just how I like to do it. The backslashes tell Bash that you are spreading the command out over several lines. If you put it all on one line, be sure it's one long unbroken line.

Make your script executable:

$ chmod +x backupscript
Sitemap | Contact Us