aboutsummaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
Diffstat (limited to 'files')
-rw-r--r--files/sync-backups16
1 files changed, 15 insertions, 1 deletions
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