Wednesday, July 30, 2008

Remote backups made easy

With rsnapshot (again), what can I say??? I simply love the program :)
You can actually even enable the remote execution to happen form the same rsnapshot config file, but I prefer to have another script to do that, because:

- On the local machine, Rsnapshot does a whole backup to everything I can backup -as long as the HDD space can handle it-.

- The custom script uses as a base the latest rsnapshot backup, and syncs from that directory to the remote server.

- This custom script filters what should be sync'd to the remote server and what not.


This is the script:

#!/bin/sh

HOST='your.remote.host.here'
USER='your.username.here'
WORK_DIR='/the/path/to/the/local/files/here/'
REMOTE_DIR='/the/path/to/the/remote/dire/here/'
PRIORITY='/bin/nice -n +19'
RSYNC='/usr/bin/rsync'
RSYNC_OPTS='-e ssh -avzr --delete --progress --bwlimit=20'
EXCLUDE_LIST='/the/path/to/the/file/containing/the/excluded/files/and/directories/ja/ja/file.list'

cd ${WORK_DIR}

${PRIORITY} ${RSYNC} ${RSYNC_OPTS} --exclude-from=${EXCLUDE_LIST} * ${USER}@${HOST}:${REMOTE_DIR}

# EoF #


This script is invoked via cronjob, and, the login to the remote server is done via SSH with public keys.

Labels: , , ,

0 Comments:

Post a Comment

<< Home