Koozali.org: home of the SME Server

Obsolete Releases => SME 9.x Contribs => Topic started by: DanB35 on April 15, 2015, 02:46:23 PM

Title: Autostart VirtualBox VMs?
Post by: DanB35 on April 15, 2015, 02:46:23 PM
I've installed phpVirtualBox on my SME 9 server following http://wiki.contribs.org/Phpvirtualbox, have some VMs running, and all seems to be working well.  I'd like to set things up so that two of my VMs start automatically when I boot my SME server, and stop/suspend automatically when I shut it down/reboot.  The phpVirtualBox page links to http://wiki.contribs.org/VirtualBox_4.0_on_SME_Server_v8_beta_6#Automatically_Start_Virtual_Machine for that procedure, but I note that (1) the page is geared to SME 8.0b6, while current is 9.0, and (2) it's geared to VB 4.0, while current is 4.3.something.

I also note that the first step in those instructions is to edit /etc/sysconfig/vbox, which doesn't exist on my system.  Are there more current instructions to do this?
Title: Re: Autostart VirtualBox VMs?
Post by: Stefano on April 15, 2015, 03:02:26 PM
I'd start to search with google for "virtualbox autostart vm centos"..

if you find anything usefull, please feel free to update wiki, thank you
Title: Re: Autostart VirtualBox VMs?
Post by: DanB35 on April 15, 2015, 03:38:35 PM
OK, a few minutes with Google has found this page: http://lifeofageekadmin.com/how-to-set-your-virtualbox-vm-to-automatically-startup/

With a few alterations to be consistent with the installation on SME, the process looks like this:

I don't see that either /etc/default/virtualbox or anything in /etc/vbox/ are templated--the standard template warning header isn't on either file, and neither /etc/e-smith/templates/etc/default/ nor /etc/e-smith/templates/etc/vbox/ exist.  This process does seem to work for me--the two VMs I want to start on boot are starting.  Any red flags before I add this to the wiki for phpvirtualbox?

Edit: VBoxManage allows you to set a few other flags for the VM that may be relevant.  Two are --autostop-type (I don't see that its options are documented very well, but the value of savestate will suspend the machine) and --autostart-delay (delay in seconds before the VM is started).
Title: Re: Autostart VirtualBox VMs?
Post by: stephdl on April 15, 2015, 05:39:30 PM
please dan, write all of this in the wiki, that could be useful for someone, I need also to find time there is a new version of phpvirtualbox
Title: Re: Autostart VirtualBox VMs?
Post by: DanB35 on April 15, 2015, 05:57:58 PM
Done.
Title: Re: Autostart VirtualBox VMs?
Post by: stephdl on April 15, 2015, 06:21:35 PM
I need also to find time there is a new version of phpvirtualbox
done