Skip to content

Instantly share code, notes, and snippets.

@scemama
Created January 26, 2015 10:02
Show Gist options
  • Save scemama/17a00a59f526686e4f38 to your computer and use it in GitHub Desktop.
Save scemama/17a00a59f526686e4f38 to your computer and use it in GitHub Desktop.
Backup a VM
#!/bin/bash
MACHINE=$1
DESTINATION="/backup/VMs/"
DATE=$(date +"%F")
LONG_DATE=$(date)
cd $HOME
echo xxxxxxxxxxxxxxxxxxxxxxxx
date
echo
rm "VirtualBox VMs/$MACHINE/Snapshots"/*.sav
VBoxManage snapshot $MACHINE take $DATE --description "$LONG_DATE" --live
echo "Snapshot OK."
echo "Running rsync..."
rsync -au "VirtualBox VMs/$MACHINE" $DESTINATION
echo
date
echo xxxxxxxxxxxxxxxxxxxxxxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment