prompt to enable vnc
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 1 Aug 2018 13:19:55 +0000 (15:19 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 1 Aug 2018 13:19:55 +0000 (15:19 +0200)
gnt-vnc.sh

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