Recent Changes - Search:








edit SideBar


I've set up a script to back up data from one disk on my computer to another disk. I've created a file in my home directory that creates a backup to another disk in case the first disk fails.

The file is called and should be executable.

#! /bin/bash

echo "Backing up files from $HOME"
echo "Backing up files to $TARGET"
rsync -CHavz --delete --delete-excluded --exclude-from=$HOME/.exclude_backup.txt $HOME $TARGET

echo "Completed"

exit 1;

This file excludes a files that are listed in the .exclude_backup.txt file stored in the users home directory. The structure of this file is simply the names (without trailing slashs) of the files and directories that are to be excluded from the backup:


In this case I have excluded, for example, the .beagle directory since there is no real point in backing this up. You can exclude any and all application data that you want, and this is probably most easily achieved using a regular expression for all the hidden files. For more on this see man rsync. This is then added to the list of cron jobs. cron is a program used to schedule events in linux. To add an event to this type: crontab -e. This will bring up a text editor where you add the following line:

0 5 * * * /home/haslam/

This tells the cron program to run the backup script daily at 5AM.

A walkthrough on setting up remote backups, using passwordless ssh, will be added.

Edit - History - Print - Recent Changes - Search
Page last modified on March 21, 2007, at 02:10 PM CET