User Tools

Site Tools


application_specific_backups:virtualbox_on_linux_hosts

Using snapshots

This is a simple script to create a snapshot of a Virtualbox virtual machine running as a specific user. You can run this script using the RunBefore attribute in the Job resource.

It doesnt do any sanity checks, it takes a username and a vm name and creates a snapshot for the vm given. It does not check existance of the user, existance of the vm, space availability, etc.

#!/bin/sh

# Pass the user running the VM as paramater 1
# Pass the VM name running by the user as parameter 2

# if you need to adjust paths for the binaries called, adjust the variables ''su'' and ''vboxm'' accordingly
user="$1"
vm="$2"
snapname="bacula-$(date '+%Y%m%d-%H%M%S')"
su="/bin/su"
vboxm="/usr/bin/VBoxManage"

$su "$user" -c "$vboxm snapshot \"$vm\" take \"$snapname\""

exit 0
application_specific_backups/virtualbox_on_linux_hosts.txt · Last modified: 2014/10/05 00:56 by bekks