Page 1 of 1
How to schedule a VM to start with linux?
Posted: 19. Aug 2009, 20:22
by henriquelm
I would like to know if it's possible to schedule a virtual machine to start together with a linux server without the GUI?
If it's possible I would like to know how to do that.
Thanks
Re: How to schedule a VM to start with linux?
Posted: 19. Aug 2009, 21:50
by vbox4me2
Cron and a script with vboxheadless?
Re: How to schedule a VM to start with linux?
Posted: 19. Aug 2009, 23:24
by Sasquatch
Just starting during or right after boot? Init script.
Re: How to schedule a VM to start with linux?
Posted: 20. Aug 2009, 21:25
by virtualdisaster
Yeah on ubuntu you can use, (I think), /etc/rc.local and include any scripts you have. I feel it should be easy enough to do. I plan on writing some shell scripts to manage headless vbox instances which will include a way to auto start virtual machines.
Re: How to schedule a VM to start with linux?
Posted: 20. Aug 2009, 21:49
by TerryE
/etc/rc.local is not the best place, because you want to savestate any running VMs on shutdown as well. I have created a custom entry in /etc/init.d with the standard stop|start|restart|status option. The stop enumerates the running vms, records which are running and savestate's them. The start powers up any saved VMs using VBoxHeadless.
Use update-rc.d to add the entries to the /etc/rc.N directories.
OK, all of my normal VMs are headless LAMPs, but this does mean that I can just shutdown and restart my host without worrying about my VMs.
Re: How to schedule a VM to start with linux?
Posted: 20. Aug 2009, 23:05
by virtualdisaster
I like the way you approached it but you still might want to add a feature for the "snapshot" feature so when a VM is running and you restart/stop host that it stops it cleanly. Isn't there a API for vbox-addons so that you can trigger scripts on the guest? Sorta like how vmware does it in virtual infrastructure. By the way would you mind sharing your finds? It seems like you have a pretty sweet setup that others could benefit from as well.
Re: How to schedule a VM to start with linux?
Posted: 20. Aug 2009, 23:35
by TerryE
Yup when we have the new VBox wiki opened, it's on the ToDo list of tutorials to write.