added "install it" target
[gnt-info] / gnt-vnc.sh
1 #!/bin/sh -e
2
3 instance=$1
4
5 test -z "$instance" && echo "Usage: $0 instance" && exit 1
6
7 while ! connection=`gnt-instance info $instance | tee /dev/shm/$instance | grep 'console connection:'` ; do
8         echo "# [$connection]"
9         read -p "$instance VNC disabled, enable? [YES, abort with CTRL+C now] " no_abort
10         gnt-instance modify -H vnc_bind_address=127.0.0.1 $instance
11         #gnt-instance reboot $instance
12 done
13
14 echo $connection | tr -d '()' | tr ':' ' ' | awk '{ print "ssh -L "$6":"$5":"$6" "$8"\nvncviewer localhost:"$10 }' | sed "s/\.gnt\.ffzg\.hr/.net.ffzg.hr/"
15