#!/bin/sh # # backup.sh, Copyright © 2011 Matteo Cypriani # # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. # # Transfers a single directory to a remote host using rsync. The # transfer is retried until it succeeds. # Any of the protocol supported by rsync, with the "://" (blank to use # SSH): PROTO=rsync:// # Remote backup host: HOST=vicious # Destination of the backup on the remote host: REMOTE_DIR=/backup # Local directory to backup: LOCAL_DIR="$HOME" # File where the excludes patterns are stored (one per line): EXCLUDES="$HOME/.backup-excludes" # Blank to keep the locally deleted files on the remote host (you can # also set to --delete-after or --delete-before): DELETE="--delete" false until [ $? -eq 0 ] ; do rsync -av ${DELETE} --exclude-from="$EXCLUDES" \ "$LOCAL_DIR" ${PROTO}://${HOST}:"$REMOTE_DIR" done