I noticed a little while ago that virtualbox-bin came with an init script and decided to try it out. *Trouble is, the script starts a virtualbox VM just fine, it just can't stop one. * Check out /etc/conf.d/virtualbox.my-vm:
# Username to start vbox as, must be part of vboxusers group.VM_USER="dcowsill"
# Virtual Machine NameVM_NAME="my-vm"
# Shutdown Method: pause|resume|reset|poweroff|savestate|acpipowerbut ton|acpisleepbuttonVM_SHUTDOWN="savestate"
# Nice Priority: -20 (most favorable scheduling) to 19 (least favorable)
# Specified the path explicitly...VBOXPATH="/usr/bin:/opt/bin"
The only trouble I had with the arrangement was that I had to explicitly specify the path for virtualbox to actually work. *I thought this was silly, but it resulted in a (semi) working script, so whatever. *Of course, I have a similarly named file linked to /etc/init.d/virtualbox where necessary.
When this script is run, the virtual machine starts fine, but when the script is stopped, the script hangs indefinitely and prints dots to the screen, presumably as it waits for my virtual machine to savestate.
So, any tips? *Cursory googling didn't reveal anything terribly applicable, so I turn to you fine fellows.