vboxcontrol: manage your VirtualBox machines

This script was developed for use on an Ubuntu host machine. These
instructions are for such a system as well.

Latest version: vboxcontrol-2008051100_2.tar.gz
ChangeLog: ChangeLog
LICENSE: LICENSE (public domain)

    * Addition: Kenny Gryp made a script to check if configured machines are
    still running, which can be run from cron. You can download it here.

ABOUT
The main purpose of this script is to launch virtualbox guest instances when
the host boots, as VirtualBox itself currently offers no functionality to do
this. It also sets up the required bridge and tap interfaces automatically,
which when done manually is a PITA.

INSTALLATION
    * Make sure you have sudo, bridge-utils, uml-utilities and
      obviously VirtualBox installed
    * Put the vboxcontrol script in the /etc/init.d/ directory
    * Make the script executable:
      chmod 0755 /etc/init.d/vboxcontrol
    * If you use 'Host interface' networking, put a br0 entry in
      /etc/network/interfaces: iface br0 inet dhcp
    * Create a new directory called /etc/virtualbox
    * Create a file called /etc/virtualbox/config with the following
      lines:

        HOST_IF="eth0"
        HOST_IP="192.168.1.5"
        VM_USER="jochem"
        USE_NAT="no"
        TAPS="tap0 tap1"

      Change all values appropriately for your system:
        HOST_IF is the interface which VirtualBox uses to bridge.

        HOST_IP is the standard ip address of the host.

        VM_USER is the system user under which all virtual machines
        will run.

        USE_NAT specifies if you want to use NAT networking (set it to
        "yes") or Host interface networking (set it to "no")

        TAPS are the tap interfaces you want to set up. Use one for
        each VM, seperate them by a space. Only applicable if
        USE_NAT is set to "no".

    * Create a file called /etc/virtualbox/machines_enabled with a
      virtual machine name on each line. Example:

        Debian Webserver
        OpenBSD Fileserver

    * Set up VirtualBox to use the specified tap interfaces for your
      machines (in the Network settings screen for your VM, set
      'Attached To' to 'Host Interface', and 'Interface Name' to
      'tap0' for the first VM, 'tap1' for the second VM, etc.

    * Let the script start up at boot:

        # update-rc.d vboxcontrol defaults 99 10

      This command starts the machine at the latest possible time,
      when everything else has already booted, and at reboot/shutdown
      it's executed in the beginning of the shutdown procedure)


USAGE
    Start all specified virtual machines:
    # /etc/init.d/vboxcontrol start

    Stop all virtual machines:
    # /etc/init.d/vboxcontrol stop

    View status of all running virtual machines:
    # /etc/init.d/vboxcontrol status

    Start a specific vm called :
    # /etc/init.d/vboxcontrol start-vm 

    Stop a specific vm called  (this sends an acpi power down
    event):
    # /etc/init.d/vboxcontrol stop-vm 

    Turn off a specific vm called  (this sends an immediate
    power down event):
    # /etc/init.d/vboxcontrol poweroff-vm 

    Bring the configured bridge up:
    # /etc/init.d/vboxcontrol bridge-up

    Bring the configured bridge down:
    # /etc/init.d/vboxcontrol bridge-down

    Bring up the configured tap devices:
    # /etc/init.d/vboxcontrol taps-up

    Bring down the configured tap devices:
    # /etc/init.d/vboxcontrol taps-down


ISSUES
    - The 'stop' command stops all virtual machines, not just the ones
      configured in /etc/virtualbox/machines_enabled

    - Perhaps the main functionality should not be in an init.d
      script; this would make portability easier


CONTACT
The original author is Jochem Kossen. You can reach him at
jkossen@xs4all.nl