working vnc initializer
This commit is contained in:
27
vnc/vnc_functions
Normal file
27
vnc/vnc_functions
Normal 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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user