Skip to content

Instantly share code, notes, and snippets.

@pweinzettel

pweinzettel/vt8.sh

Created Aug 28, 2020
Embed
What would you like to do?
Run Virtual Box (or any other gui software) on separate virtual terminal
#!/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