Jump to content

Headless unix VBox snapshot creation.


Recommended Posts

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

Link to post
Share on other sites
  • 2 weeks later...
  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...