Auto close Guest OS before ubuntu shutdown?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
grassvalley
Posts: 4
Joined: 17. Jan 2008, 05:19
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: windows xp

Auto close Guest OS before ubuntu shutdown?

Post by grassvalley »

I want auto close guest os before ubuntu shutdown, How can I do?

Sorry ?my English is so bad.
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Post by frank »

In your shutdown script you should call
VBoxManage list vms
and search within that list for VMs with a running state. Then enumerate over these VMs and do
VBoxManage controlvm poweroff
or
VBoxManage controlvm acpipowerbutton
grassvalley
Posts: 4
Joined: 17. Jan 2008, 05:19
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: windows xp

Post by grassvalley »

I can't write script, can you give me a script for this ?
I host OS is ubuntu 7.10.
Thanks.
ricoch3n
Posts: 2
Joined: 24. Jan 2008, 03:58

VBoxManage controlvm poweroff is not a good way

Post by ricoch3n »

"VBoxManage controlvm poweroff vm_name" would shutdown the host computer. However this is like pushing the power button of a computer, that is to say, the state of the guest os will not be saved and it could even lead to data corruption on the guest computer. A better way to do is to ssh to the guest computer and issue a "shutdown -h now" command if the guest is a Linux os. You can make it even better by implementing password-less ssh access to the guess os so the command can be issued from the host computer.
frank
Oracle Corporation
Posts: 3362
Joined: 7. Jun 2007, 09:11
Primary OS: Debian Sid
VBox Version: PUEL
Guest OSses: Linux, Windows
Location: Dresden, Germany
Contact:

Post by frank »

Then use the second method (acpipowerbutton).
Post Reply