LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   virtualbox's virtual machine start on boot (http://www.linuxquestions.org/questions/linux-server-73/virtualboxs-virtual-machine-start-on-boot-626120/)

paul_mat 03-06-2008 07:42 AM

virtualbox's virtual machine start on boot
 
hi there,

i'm looking for a way for a server to start a virtual machine using virtual box on boot?

for example:
the host PC boots up and once it's finished booting it then starts a virtual machine running inside of virtualbox.

DiWi 03-06-2008 07:56 AM

I'm using virtual box too, but the server is running on Windows :(

Never than less, starting an application on boot is pretty simple:

First: Do you have to start the VBox as root? If not, you should create a new user that is used by the process running VBox. You can disable the user.

Second: Create a shell script that can starts and stop the VBox, based on a parameter value start/stop. Test is as vbox user. If it works, no problem

Third: add a script as root into /etc/init.d that runs the vbox user script as vbox user (usually su - vbox -c /home/vbox/vboxcrtl start on $1=start and similar when stop). Test this script as root. It should now start and stop the VM based on the parameter

Fourth: add two links with name S21VBoxVM and K21VBoxVM to /etc/init.d/rc5.d pointing to your script in /etc/init.d

Restart your system and vola it should work

Dirk


All times are GMT -5. The time now is 09:18 PM.