Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Oracle VM Virtualbox on my Windows 7 development machine. I want to start a VM when Windows starts, and cleanly shut that VM down when Windows stops.

Can that be done?

I can start a headless VM by entering this on the command line;

"C:\Program Files\Oracle\VirtualBox\vboxheadless" -startvm "sw (Ubuntu 12.04)"

How can I 'cleanly' stop that VM? IE. How can I send an ACPI Shutdown to that VM?

share|improve this question

1 Answer 1

Yes.

  1. Configure your guest OS to shut down on pressing the power button. For Ubuntu 12.04 with GUI it depends on your Desktop Environment installed on where to configure that in the system settings.

    For headless machines, make sure you have installed the package acpid.

  2. Execute

    VBoxManage controlvm "VM Name" acpipowerbutton
    

Reference: VBoxManage controlvm documentation


Alternatively, use SSH and PuTTY to execute the command shutdown -h now without interaction as described in "How to run a command file in PuTTY using automatic login in a command prompt?" on Superuser.com.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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