aboutsummaryrefslogtreecommitdiff
path: root/files/sync-backups
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-09-20 16:26:20 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-09-20 16:26:20 -0300
commit3468af105bcd312e1617c05bef3259b6adf78d86 (patch)
tree299d5caa1eaa95e09c013a65c3b6655f438f9096 /files/sync-backups
parent5c9b124f84016d285a49936157882aa81f15a772 (diff)
downloadpuppet-backup-3468af105bcd312e1617c05bef3259b6adf78d86.tar.gz
puppet-backup-3468af105bcd312e1617c05bef3259b6adf78d86.tar.bz2
Copying encrypted images at sync-backup
Diffstat (limited to 'files/sync-backups')
-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