aboutsummaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-02-16 21:32:44 -0200
committerSilvio Rhatto <rhatto@riseup.net>2011-02-16 21:32:44 -0200
commit0152ea638ad8f34a1fab6136638290bce89096ac (patch)
tree3e9021eff5ec7ee1018eccc80e10c5e37a8dc658 /files
parentaf503238f0000a00c3569f0502d61e42e506d19a (diff)
downloadpuppet-backup-0152ea638ad8f34a1fab6136638290bce89096ac.tar.gz
puppet-backup-0152ea638ad8f34a1fab6136638290bce89096ac.tar.bz2
Get full node hostname on sync-backups
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.