Jump to content

Headless unix VBox snapshot creation.


Recommended Posts

Posted

Just in case if anyone interested, I'm sharing my script that support Unix headless Virtual Box snapshot creation.

 

I have two VirtualBox machine (Linux, Win10) and both are running under different username.

Since, pulseway is running under root privilege, I should use su to virtualbox user and pass the specific command to shell.

Please update as needed.

Thanks

---------------------------------------------

#!/bin/bash
NOW=`date +"%m-%d-%Y-%T"`
SNAPSHOT_NAME_Linux="Linux_$NOW"
SNAPSHOT_NAME_Win10="Win10_$NOW"
SNAPSHOT_DESCRIPTION="Snapshot taken on $NOW"

su -l "vboxusername" -c "/usr/bin/VBoxManage snapshot Linux take "$SNAPSHOT_NAME_Linux" --description "$SNAPSHOT_DESCRIPTION"" &
su -l "vboxusername" -c "/usr/bin/VBoxManage snapshot Win10 take "$SNAPSHOT_NAME_Win10" --description "$SNAPSHOT_DESCRIPTION"" &

exit 0

  • 2 weeks later...
  • 3 years later...
Posted

A possible solution with my script. 

It create a log, keep 7 snapshots and delete the oldest, create a clon and delete the old clon, work with many virtual machines and at the end reboot the host

Regards

https://github.com/nktrabajo/bashbackups

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...