File tree Expand file tree Collapse file tree 4 files changed +29
-25
lines changed Expand file tree Collapse file tree 4 files changed +29
-25
lines changed Original file line number Diff line number Diff line change @@ -53,4 +53,4 @@ xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
53
53
NODE_PID=$!
54
54
55
55
trap shutdown SIGTERM SIGINT
56
- wait $NODE_PID
56
+ wait ${ NODE_PID}
Original file line number Diff line number Diff line change 52
52
53
53
rm -f /tmp/.X* lock
54
54
55
- xvfb-run -a --server-args=" -screen 0 $GEOMETRY -ac +extension RANDR" \
55
+ # Creating a file descriptor, where the DISPLAY will be saved ("6" was arbitrarily chosen)
56
+ exec 6> /tmp/display.log
57
+ xvfb-run -a --server-args=" -screen 0 $GEOMETRY -ac +extension RANDR -displayfd 6" \
56
58
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
57
59
-role node \
58
- -hub http://$HUB_PORT_4444_TCP_ADDR : $ HUB_PORT_4444_TCP_PORT /grid/register \
60
+ -hub http://${ HUB_PORT_4444_TCP_ADDR} : ${ HUB_PORT_4444_TCP_PORT} /grid/register \
59
61
${REMOTE_HOST_PARAM} \
60
62
-nodeConfig /opt/selenium/config.json \
61
63
${SE_OPTS} &
62
64
NODE_PID=$!
65
+ exec 6>& -
63
66
64
67
trap shutdown SIGTERM SIGINT
65
68
for i in $( seq 1 10)
66
69
do
67
- DISPLAY= $( xvfb-run printenv DISPLAY )
68
- if [ -z " $ DISPLAY" ] ; then
69
- echo " \$ DISPLAY env variable is empty "
70
- break
70
+ sleep 1
71
+ export DISPLAY=: $( cat /tmp/display.log )
72
+ if [ " ${ DISPLAY} " != " : " ] ; then
73
+ echo " Display ${DISPLAY} allocated "
71
74
fi
72
- xdpyinfo -display $DISPLAY > /dev/null 2>&1
75
+ xdpyinfo -display ${ DISPLAY} > /dev/null 2>&1
73
76
if [ $? -eq 0 ]; then
74
77
break
75
78
fi
76
- echo Waiting xvfb...
77
- sleep 0.5
79
+ echo " Waiting xvfb..."
78
80
done
79
81
80
- fluxbox -display $DISPLAY &
82
+ fluxbox -display ${ DISPLAY} &
81
83
82
- x11vnc $X11VNC_OPTS -forever -shared -rfbport 5900 -display $DISPLAY &
84
+ x11vnc ${ X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${ DISPLAY} &
83
85
84
- wait $NODE_PID
86
+ wait ${ NODE_PID}
Original file line number Diff line number Diff line change @@ -21,4 +21,4 @@ xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
21
21
NODE_PID=$!
22
22
23
23
trap shutdown SIGTERM SIGINT
24
- wait $NODE_PID
24
+ wait ${ NODE_PID}
Original file line number Diff line number Diff line change 22
22
23
23
rm -f /tmp/.X* lock
24
24
25
- xvfb-run -a --server-args=" -screen 0 $GEOMETRY -ac +extension RANDR" \
25
+ # Creating a file descriptor, where the DISPLAY will be saved ("6" was arbitrarily chosen)
26
+ exec 6> /tmp/display.log
27
+ xvfb-run -a --server-args=" -screen 0 $GEOMETRY -ac +extension RANDR -displayfd 6" \
26
28
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
27
29
${SE_OPTS} &
28
30
NODE_PID=$!
31
+ exec 6>& -
29
32
30
33
trap shutdown SIGTERM SIGINT
31
34
for i in $( seq 1 10)
32
35
do
33
- DISPLAY= $( xvfb-run printenv DISPLAY )
34
- if [ -z " $ DISPLAY" ] ; then
35
- echo " \$ DISPLAY env variable is empty "
36
- break
36
+ sleep 1
37
+ export DISPLAY=: $( cat /tmp/display.log )
38
+ if [ " ${ DISPLAY} " != " : " ] ; then
39
+ echo " Display ${DISPLAY} allocated "
37
40
fi
38
- xdpyinfo -display $DISPLAY > /dev/null 2>&1
41
+ xdpyinfo -display ${ DISPLAY} > /dev/null 2>&1
39
42
if [ $? -eq 0 ]; then
40
43
break
41
44
fi
42
- echo Waiting xvfb...
43
- sleep 0.5
45
+ echo " Waiting xvfb..."
44
46
done
45
47
46
- fluxbox -display $DISPLAY &
48
+ fluxbox -display ${ DISPLAY} &
47
49
48
- x11vnc $X11VNC_OPTS -forever -shared -rfbport 5900 -display $DISPLAY &
50
+ x11vnc ${ X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${ DISPLAY} &
49
51
50
- wait $NODE_PID
52
+ wait ${ NODE_PID}
You can’t perform that action at this time.
0 commit comments