From 3468af105bcd312e1617c05bef3259b6adf78d86 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 20 Sep 2010 16:26:20 -0300 Subject: Copying encrypted images at sync-backup --- files/sync-backups | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'files') diff --git a/files/sync-backups b/files/sync-backups index b75fe90..87a4a75 100644 --- a/files/sync-backups +++ b/files/sync-backups @@ -6,6 +6,7 @@ NODE="$1" MEDIA="/media/usb" BWLIMIT="5000" +IMAGES="/var/data/crypt/" RSYNC="nice -n 19 rsync -av --delete --bwlimit=$BWLIMIT" if [ ! -z "$NODE" ]; then @@ -13,9 +14,22 @@ if [ ! -z "$NODE" ]; then $RSYNC /var/vservers/$NODE/var/backups/remote/$node/ /$MEDIA/$node/ done else - $RSYNC /var/backups/duplicity/ /$MEDIA/$HOSTNAME/ + # Sync local encrypted backup. + mkdir -p /$MEDIA/$HOSTNAME/duplicity + $RSYNC /var/backups/duplicity/ /$MEDIA/$HOSTNAME/duplicity/ + # Sync remote backups. for node in `ls /var/backups/remote/`; do + mkdir -p /$MEDIA/$node/ $RSYNC /var/backups/remote/$node/ /$MEDIA/$node/ done + + # Copy encrypted images. + if [ -d "$IMAGES" ]; then + for image in `find $IMAGES -type f`; do + mkdir -p /$MEDIA/$HOSTNAME/images/`dirname $image` + echo "Copying image to /$MEDIA/$HOSTNAME/images/`dirname $image`" + cp $image /$MEDIA/$HOSTNAME/images/`dirname $image` + done + fi fi -- cgit v1.2.3