Created
June 10, 2017 03:03
-
-
Save ladar/395b2c8a2e5103c34472f3fea4dd53de to your computer and use it in GitHub Desktop.
Shell script used to connect with the packer builds currently under construction.
This file contains hidden or 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 | |
# Sudo is needed to find the vmware-vmx ports. | |
PORT=`sudo netstat -pnl 2>&1 | grep tcp | grep -E "vmware-vmx|qemu|qemu-kvm" | awk -F':' '{print $2}' | awk -F' ' '{print $1}' | grep -E "^59"` | |
for p in $PORT; do | |
#rpm -q virt-viewer &> /dev/null || (printf "\n\nA VNC port was detected, but the Virt Viewer doesn't appear to be available.\n\n" && exit 1) | |
#remote-viewer vnc://127.0.0.1:$p &> /dev/null & | |
rpm -q vinagre &> /dev/null || (printf "\n\nA VNC port was detected, but Vinagre doesn't appear to be available.\n\n" && exit 1) | |
vinagre --vnc-scale vnc://127.0.0.1:$p &> /dev/null & | |
done | |
# Sudo is also needed to find the virtualbox ports. | |
PORT=`sudo netstat -pnl 2>&1 | grep tcp | grep "VBoxHeadless" | awk -F':' '{print $2}' | awk -F' ' '{print $1}' | grep -E "^59"` | |
for p in $PORT; do | |
rpm -q vinagre &> /dev/null || (printf "\n\nAn RDP port was detected, but Vinagre doesn't appear to be available.\n\n" && exit 1) | |
vinagre --vnc-scale rdp://127.0.0.1:$p &> /dev/null & | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment