Backup script (rsync via ssh)

This is my totally not original backup script. I have symbolic links sitting in a directory, to files and folders I want to save. This directory is saved on a remote host.

[download backup.sh]

#!/bin/bash

set -u
set -e

# The directory to be backed up
DIR="$HOME/backed.up/"

# The remote host
RHOST="whatever"

# The directory on the remote host
RDIR=`hostname`/

# rsync options reminder:
#   -a archive mode
#   -v verbose
#   -z compression during transfer
#   --delete remove files that were deleted in the source directory
#   --copy-unsafe-links
#        when a symlink is encountered, the referent is copied
#        instead, *only* if it is out of the saved tree

rsync -avz --delete --copy-unsafe-links -e ssh $DIR $RHOST:$RDIR

Posted by pierre on 25 July 2007 in bash

Leave a Reply

*