As some people are aware, I use Bytemark for all of my hosting, and I also resell some of their services. I’ve recently switched to performing my backups via rsync and thought I would share the simple script I use in case any other Bytemark customer is looking to do the same thing.
for dir in $BACKUPDIRS ; do
rsync --delete -qazr "$dir" $VMNAME.backup.bytemark.co.uk::$VMNAME/"$dir"
The only change required is that you need to set the VMNAME variable to the name of your virtual machine, and change
BACKUPDIRS to list all the directories which you want to backup.
Some important caveats:
- You must have Bash installed in order for this script to work, though it doesn’t have to be your default shell.
- This script will not backup non-file data, such as MySQL databases. I will post a separate script once I get round to performing this task.
- The complete contents of the directories specified in
BACKUPDIRSwill be backed up, there is no way to say ‘backup
- The first time you run this script it will take a while for rsync to copy all the data, but subsequent runs should be much faster.
- I think this only works for virtual machines and not dedicated hosts.
As rsync only copies the files required, you can probably run this script more frequently than a full backup script.