Ticket #4873 (closed defect: fixed)
VBoxSVC missing from headless starts
|Reported by:||ToddAndMargo||Owned by:|
When you start a headless VM, you do not get a companion VBoxSVC. This makes it impossible to shut down your headless VM, unless you start your own VBoxSVC when you are trying to shut it down.
You can see details from my shutdown script:
# wait for VBoxSVC to exit after the "VBoxManage showvminfo" command SvcDelay=10 echo "Waiting $SvcDelay seconds for VBoxManage showvminf's VBoxSVC to exit" I=0; while [ "$I" -lt "$SvcDelay" ]; do
I=expr $I + 1 echo -n "$I " sleep 1
done echo ""
echo "Shutting down $VM_Name. Waiting $ShutdownWait seconds"
SvcFound="ps alx | grep -v grep | grep VBoxSVC" if [ -z "$SvcFound" ]; then
echo "VBoxSVC process not found. Starting it" su tony -c "/usr/lib/virtualbox/VBoxSVC --automate &" sleep 4
su todd -c "/usr/bin/VBoxManage controlvm $VM_Name acpipowerbutton" Status=$? logger -p user.notice -t VM-Utils " stopping $VM_Name. Stop status <$Status>"
By the way the VBoxSVC that is spawned by "VBoxManage showvminfo" does not work with "/usr/bin/VBoxManage controlvm $VM_Name acpipowerbutton", so you have to wait for it to clear before you issue your own.
I would request: 1) "/usr/bin/VBoxManage controlvm $VM_Name acpipowerbutton" spawned its own VBoxSVC, or 2) "/usr/bin/VBoxManage controlvm $VM_Name acpipowerbutton" would not need VBoxSVC, or 3) "/usr/bin/VBoxHeadless --startvm $VM_Name &" spawned a VBoxSVC for "/usr/bin/VBoxManage controlvm $VM_Name acpipowerbutton" to use.
Let me know if you want to see the entire script.
Many thanks, -T