File: test-vnc-connection

package info (click to toggle)
tightvnc-java 1.3.10-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 796 kB
  • sloc: java: 8,934; makefile: 122; sh: 87
file content (52 lines) | stat: -rw-r--r-- 1,403 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

set -e

SERVERDISPLAY=42
CLIENTDISPLAY=43

wait_for_process() {
	PROCESS="$1"
	
	for i in `seq 10`; do
	    sleep 1
	    echo "Check $i whether '$PROCESS' is running"
	    if pgrep -f "$PROCESS"; then
	        echo "Process '$PROCESS' found."
	        return 0
	    fi
	done
	echo "Timeout on checking for process '$PROCESS'!"
	return 1
}

echo 'Starting primary VNC server (server side) ...'
Xtightvnc :$SERVERDISPLAY -geometry 800x600 >/tmp/display{$SERVERDISPLAY}.log 2>&1 &
wait_for_process "Xtightvnc :$SERVERDISPLAY"
echo 'Starting secondary VNC server (client side) ...'
Xtightvnc :$CLIENTDISPLAY -geometry 1024x768 >/tmp/display{$CLIENTDISPLAY}.log 2>&1 &
wait_for_process "Xtightvnc :$CLIENTDISPLAY"

echo 'Show primary server log up to now. ..'
cat /tmp/display{$SERVERDISPLAY}.log
echo 'Show secondary server log up to now ...'
cat /tmp/display{$CLIENTDISPLAY}.log

echo 'Starting VNC viewer on secondary VNC server ...'
DISPLAY=:$CLIENTDISPLAY jtightvncviewer localhost:$SERVERDISPLAY >/tmp/vncviewer.log 2>&1 &
sleep 5
wait_for_process "java tightvncviewer.VncViewer"

echo 'Show entire server display log ...'
cat /tmp/display{$SERVERDISPLAY}.log

echo 'Show entire client display log ...'
cat /tmp/display{$CLIENTDISPLAY}.log

echo 'Show vnc viewer log ...'
cat /tmp/vncviewer.log

echo 'Stopping viewer and VNC servers ... '
pkill jtightvncviewer
pkill Xtightvnc
echo 'Done.'