当前位置: 动力学知识库 > 问答 > 编程问答 >

bash - How to Determine If a VirtualBox Appliance Is Headless?

问题描述:

A VirtualBox virtual machine may be launched headless or with the traditional GUI type. I've sifted through the vboxmanage documentation but can't find a way query the current type. Short of grepping running processes or X windows, what's the best mechanism to determine if a VM is headless from Bash?

Note: I also tried diffing vboxmanage showvminfo and vboxmanage guestproperty enumerate between headless and GUI sessions but the only deltas were timestamps.

网友答案:

Some ideas...

If you're using Linux try comparing their /proc/${PID} directories. Maybe you could find the open socket in fd/ or a DISPLAY env set in environ. Beware it's zero-terminated (use tr '\0' '\n').

Cheers

分享给朋友:
您可能感兴趣的文章:
随机阅读: