From: tfheen Date: Tue, 5 Jun 2012 15:25:02 +0000 (+0000) Subject: Allow overriding VNCDISPLAY X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ef0089ae737f07ef555757cf80e77a05534c658;p=dotfiles Allow overriding VNCDISPLAY git-svn-id: file:///svn/tfheen/trunk/dotfiles@1541 8da78d58-1cd3-0310-bee5-d77bd1b3e8bf --- diff --git a/zshfunc/vnc b/zshfunc/vnc index a0985cd..fba69ae 100755 --- a/zshfunc/vnc +++ b/zshfunc/vnc @@ -11,7 +11,9 @@ HOST=$1 VM=$2 LPORT=$(( $RANDOM % 10000 + 5900)) -VNCDISPLAY=$(ssh $HOST "gnt-instance list --no-headers -o name,network_port | awk '/^$VM/ { print \$2 - 5900 } END { exit 1; }' || virsh -c qemu:///system vncdisplay $VM | sed s/://") +if [ -z "$VNCDISPLAY" ]; then + VNCDISPLAY=$(ssh $HOST "gnt-instance list --no-headers -o name,network_port | awk '/^$VM/ { print \$2 - 5900 ; exit 0 } END { exit 1; }' || virsh -c qemu:///system vncdisplay $VM | sed s/://") +fi ssh -N -f -L ${LPORT}:localhost:$(( $VNCDISPLAY + 5900 )) $HOST gvncviewer localhost:$(( $LPORT - 5900 ))