Turning host OS off automatically when guest OS turned off/closed
Posted: 18. Oct 2016, 11:06
Hello, everyone!
I've got kind of a rare question (at least I could't find anything similar in google):
How to turn off Host as soon as Guest was turned off?
A little bit of description: I am using Ubuntu 16.04 as host OS, Windows 7 Pro as guest OS, and VirtualBox 5.024 as virtualization software. Guest OS is launched automatically on startup, in fullscreen mode. But I could not find a way to send a "shutdown -P now" to host OS when guest OS was just turned off or closed.
At first, I tried to launch a virtual machine with a command, merged with a shutdown command by using ";", "&&", or "||", like this:
virtualbox /home/username/VirtualBoxVMs/myVM/myVM.vbox && shutdown -P now
Because if you type in terminal, for example, "vitualbox && gedit", gedit will be launched exactly after closing the virtualbox window, neither earlier, nor later.
But when I try this approach with virtual machine, shutdown command is either not executed, or executed together with virtual machine.
I understand that I can go a long way and write a program that will hang in the background waiting for a moment when virtual machine window is closed, then sending a shutdown command. I just want to know, is there any easier way to reach my goal?
I've got kind of a rare question (at least I could't find anything similar in google):
How to turn off Host as soon as Guest was turned off?
A little bit of description: I am using Ubuntu 16.04 as host OS, Windows 7 Pro as guest OS, and VirtualBox 5.024 as virtualization software. Guest OS is launched automatically on startup, in fullscreen mode. But I could not find a way to send a "shutdown -P now" to host OS when guest OS was just turned off or closed.
At first, I tried to launch a virtual machine with a command, merged with a shutdown command by using ";", "&&", or "||", like this:
virtualbox /home/username/VirtualBoxVMs/myVM/myVM.vbox && shutdown -P now
Because if you type in terminal, for example, "vitualbox && gedit", gedit will be launched exactly after closing the virtualbox window, neither earlier, nor later.
But when I try this approach with virtual machine, shutdown command is either not executed, or executed together with virtual machine.
I understand that I can go a long way and write a program that will hang in the background waiting for a moment when virtual machine window is closed, then sending a shutdown command. I just want to know, is there any easier way to reach my goal?