2009-04-10

run guest OS as service

isn't it a good idea to have your virtualbox based guest OS running on host system starting ?

let me show you how it can be done :

Suppose that you already have a guest os, such as JeOS. you can start it from command line :

>VBoxManage startvm "Ubuntu Server" -type vrdp  #your server's name , or vm id which you may already know. pay attention to the "-type vrdp", it means starting the guestOS in non-GUI mode.

the script for shutdown is :

>VBoxManage controlvm "Ubuntu Server" poweroff

these two lines are the core code, we write a shell file to include it (lets name it ubuntu.server.sh and put it under /etc/iniit.d/ , omit the file content....), and schedule it :

>sudo update-rc.d ubuntu.server.sh start 40 2 3 . stop 01 0 1 6 .

now you dont have to start the guestOS manually every time restart the machine :)

No comments: