aboutsummaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
Diffstat (limited to 'files')
-rw-r--r--files/sync-backups14
1 files changed, 10 insertions, 4 deletions
diff --git a/files/sync-backups b/files/sync-backups
index 230ce1e..cb40c77 100644
--- a/files/sync-backups
+++ b/files/sync-backups
@@ -10,14 +10,20 @@ IMAGES="/var/data/crypt/"
RSYNC="nice -n 19 rsync -avH --delete --bwlimit=$BWLIMIT"
if [ ! -z "$NODE" ]; then
+ # Get full node hostname.
+ NODE_HOSTNAME="`cat /var/vservers/$NODE/etc/hostname`"
+ if [ -z "$NODE_HOSTNAME" ]; then
+ NODE_HOSTNAME="$NODE"
+ fi
+
# Sync local encrypted backup.
- mkdir -p /$MEDIA/$NODE/duplicity
- $RSYNC /var/vservers/$NODE/var/backups/duplicity/ /$MEDIA/$NODE/duplicity/
+ mkdir -p /$MEDIA/$NODE_HOSTNAME/duplicity
+ $RSYNC /var/vservers/$NODE/var/backups/duplicity/ /$MEDIA/$NODE_HOSTNAME/duplicity/
# Sync remote backups.
for node in `ls /var/vservers/$NODE/var/backups/remote/`; do
- mkdir -p /$MEDIA/$NODE/remote/$node
- $RSYNC /var/vservers/$NODE/var/backups/remote/$node/ /$MEDIA/$NODE/remote/$node/
+ mkdir -p /$MEDIA/$NODE_HOSTNAME/remote/$node
+ $RSYNC /var/vservers/$NODE/var/backups/remote/$node/ /$MEDIA/$NODE_HOSTNAME/remote/$node/
done
else
# Sync local encrypted backup.