2011-08-16 23:42:32 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# backup.sh, Copyright © 2011 Matteo Cypriani <mcy@lm7.fr>
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2018-04-11 22:31:14 +02:00
|
|
|
# Any of the protocol supported by rsync, with the "://" (comment-out to use
|
2011-08-16 23:42:32 +02:00
|
|
|
# SSH):
|
2018-04-11 22:31:14 +02:00
|
|
|
#PROTO=rsync://
|
2011-08-16 23:42:32 +02:00
|
|
|
# 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"
|
2018-04-11 22:31:14 +02:00
|
|
|
# Remove --delete to keep the locally deleted files on the remote host (you can
|
2011-08-16 23:42:32 +02:00
|
|
|
# also set to --delete-after or --delete-before):
|
2018-04-11 22:31:14 +02:00
|
|
|
RSYNC_OPTS="-av --delete"
|
2011-08-16 23:42:32 +02:00
|
|
|
|
2018-04-11 22:31:14 +02:00
|
|
|
# shellcheck disable=2086
|
|
|
|
until rsync $RSYNC_OPTS --exclude-from="$EXCLUDES" \
|
|
|
|
"$LOCAL_DIR" "${PROTO}${HOST}:$REMOTE_DIR"
|
|
|
|
do
|
|
|
|
echo "Retrying..."
|
2011-08-16 23:42:32 +02:00
|
|
|
done
|
2018-04-11 22:31:14 +02:00
|
|
|
|
|
|
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|