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
.backup.sh and should be executable.
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
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 is a program used to schedule events in linux. To add an event to this type:
This will bring up a text editor where you add the following line:
0 5 * * * /home/haslam/.backup.sh
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.