working vnc initializer

This commit is contained in:
ville rantanen
2013-09-17 15:42:10 +03:00
parent 870aa023ce
commit f9b0b52ebb

27
vnc/vnc_functions Normal file
View File

@@ -0,0 +1,27 @@
function get_vnc() {
# USAGE:
# get_vnc
# do_your_X11_stuff
# kill_vnc
local i
for ((i=0;$i<60;i++)); do
vncserver :$i -depth 24 -geometry 1024x768 -geometry 800x600 -geometry 1366x768 -geometry 1280x1024 -geometry 1680x1050 2>&1
if [ $? -eq 0 ]; then
VNCDISPLAY=$i
export DISPLAY=:$i
VNCPORT=$(( 5900 + $i ))
echo DISPLAY=$DISPLAY
echo VNCPORT=$VNCPORT
return 0
fi
done
# failed to start
return 1
}
function kill_vnc() {
vncserver -kill $DISPLAY
}