Created
August 28, 2020 00:24
-
-
Save pweinzettel/6eb877244cd00c173880b06156b961b0 to your computer and use it in GitHub Desktop.
Run Virtual Box (or any other gui software) on separate virtual terminal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To get the vmid, use: | |
# VBoxManage list vms | |
VM="{3b019d6d-16d1-4a8b-909d-8c79e53abd2d}"; | |
XN=4; | |
XS=/tmp/.X11-unix; | |
# Create a new X server on vt8 | |
if [ ! -S ${XS}/X${XN} ]; then | |
X -quiet -nolisten tcp -noreset :${XN} vt8 & | |
fi | |
echo -en "Waiting for X server: " | |
while [ ! -S ${XS}/X${XN} ]; do | |
echo -en '.'; | |
sleep 1; | |
done | |
echo ' done!'; | |
export DISPLAY=:${XN} | |
/usr/lib/virtualbox/VirtualBoxVM --fullscreen --startvm "${VM}" | |
echo -en "Stopping X server: " | |
while [ -S ${XS}/X${XN} ]; do | |
kill $(ps aux | grep "Xorg.*vt8$" | awk {'print$2'}) >/dev/null 2>&1 | |
echo -en '.'; | |
sleep 1; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment