Commit df241daf authored by Steve Kemp's avatar Steve Kemp
Browse files

Added script to download backups.

parent eab4fbfd
......@@ -7,6 +7,7 @@
# backup space associated with this machine and upload the local
# archive, produced by backup2l, to this location.
#
#
# Override
# --------
#
......@@ -14,6 +15,7 @@
# is assumed to contain the name and path of a remote location to
# use for the rsync upload.
#
#
# Disabling
# ---------
#
......@@ -47,9 +49,9 @@ if [ -e /etc/symbiosis/dns.d/backup.name ]; then
fi
#
# Otherwise we can rsync immediately to the specified location
# Otherwise we can rsync immediately from the specified location
#
rsync -vazr /var/backups $(cat /etc/symbiosis/dns.d/backup.name)
rsync -vazr $(cat /etc/symbiosis/dns.d/backup.name) /var/backups
exit 0;
fi
......@@ -117,6 +119,6 @@ name=$(echo $name | awk -F\. '{print $1}' )
#
# example.backup.bytemark.co.uk::example/example.vm.bytemark.co.uk/
#
rsync -vazr /var/backups $name.backup.bytemark.co.uk::$name/$(hostname --fqdn)/
rsync -vazr $name.backup.bytemark.co.uk::$name/$(hostname --fqdn)/ /var/backups
exit 0
\ No newline at end of file
#!/bin/sh
#
# Overview
# --------
#
# This script is designed to determine the name of any remote
# backup space associated with this machine and upload any files
# stored within that backup space, previously produced by backup2l,
# to the local machine.
#
# This is designed to ensure that no local backups are lost if the
# machine is re-imaged, or local backups are removed due to user-error
#
#
# Override
# --------
#
# If there is a file "/etc/symbiosis/dns.d/backup.name" it
# is assumed to contain the name and path of a remote location to
# use for the rsync upload.
#
#
# Disabling
# ---------
#
# To disable uploads completely create the an empty file named
# "/etc/symbiosis/dns.d/backup.name".
#
# Steve
# --
#
#
# Local backup directory.
#
src=/var/backups/
#
# The remote rsync location might be hardwired.
#
#
if [ -e /etc/symbiosis/dns.d/backup.name ]; then
#
# If the file is empty then we just abort.
#
if [ ! -s /etc/symbiosis/dns.d/backup.name ]; then
exit 0;
fi
#
# Otherwise we can rsync immediately to the specified location
#
rsync -vazr /var/backups $(cat /etc/symbiosis/dns.d/backup.name)
exit 0;
fi
###
##
#
# OK we don't have an explicit name specified, so we need to look it up
# dynamically.
#
##
###
#
# Find the IP address associated with eth0.
#
eth0=$(/sbin/ifconfig eth0 | grep 'inet addr:' | awk '{print $2}' | awk -F: '{print $2}' )
#
# We need the IP reversed on an octet-basis for the DNS lookup.
#
one=$(echo $eth0 | awk -F\. '{print $1}')
two=$(echo $eth0 | awk -F\. '{print $2}')
three=$(echo $eth0 | awk -F\. '{print $3}')
four=$(echo $eth0 | awk -F\. '{print $4}')
#
# Attempt to find the name of the associated backup space via a
# DNS lookup.
#
name=$(dig txt $four.$three.$two.$one.backup-reverse.bytemark.co.uk +short | tr -d \")
#
# If we didn't get a name then exit.
#
if [ -z "$name" ]; then
echo "Failed to determine backup space name for $eth0"
exit 0
fi
#
# OK we got a name of the form "foo.backup.bytemark.co.uk"
#
# Truncate at the first part.
#
name=$(echo $name | awk -F\. '{print $1}' )
#
# Now rsync.
#
# If the name of the machine is example.vm.bytemark.co.uk we'll expect
# to upload to:
#
# example.backup.bytemark.co.uk::example/example.vm.bytemark.co.uk/
#
rsync -vazr /var/backups $name.backup.bytemark.co.uk::$name/$(hostname --fqdn)/
exit 0
\ No newline at end of file
......@@ -2,8 +2,9 @@ symbiosis-firewall (2010:0701) stable; urgency=low
* Correctly process whitelisted IP addresses.
* Expire whitelisted entries which are older than 8 days.
* The blacklister will honour even auto-whitelisted IPs.
-- Steve Kemp <steve@bytemark.co.uk> Thu, 1 Jul 2010 10:55:01 +0000
-- Steve Kemp <steve@bytemark.co.uk> Thu, 1 Jul 2010 12:00:00 +0000
symbiosis-firewall (2010:0628) stable; urgency=low
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment