up vote 0 down vote favorite
3
share [g+] share [fb]

I installed VirtualBox v2.2.4 on a CentOS 5.2 host. I want the guest VMs to auto-start when the host boots up.

What's the correct solution? Where should I run VBoxHeadless from?

Edit: this question can be generalized to "what should I do to run something after boot in CentOS?".

Also, I'd like to have the output from VBoxHeadless (stdout/err) saved somewhere.

link|improve this question

60% accept rate
feedback

2 Answers

up vote 1 down vote accepted

In answer to: 'Edit: this question can be generalized to "what should I do to run something after boot in CentOS?".'

Copy /usr/share/doc/initscripts-[your version]/sysvinitfiles to /etc/init.d/[your startup file]

Edit the file following the directions contained within. Also, look at some of the other init scripts in /etc/init.d

As sysvinitfiles suggests, it's a good idea to 'man chkconfig', but the basics are:

  1. Make sure you have something similar to # chkconfig 2345 20 80 in your script
  2. $ chmod 755 [your startup file]
  3. Run $ chkconfig --add [your startup file]
  4. service [your startup file] start|stop

Having # chkconfig 2345 tells linux to start and stop your program at bootup and shutdown respectively

link|improve this answer
Great answer, thanks! – noamtm Jul 15 '09 at 15:32
feedback

vboxtool could take care of it for you:

Easy control of virtual machines of VirtualBox (virtualization solution) on a Linux headless server. Start, stop, save, backup and show status of sessions in batch mode from command line.

Place vboxtoolinit in /etc/init.d/

chkconfig --add vboxtoolinit
chkconfig --levels 2345 vboxtoolinit on
link|improve this answer
Thanks, I'll try that. I was hoping that in the latest version there might be something built-in to do it. – noamtm Jun 18 '09 at 10:28
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.