Skip to content

Grabbing the display created by Xvfb and passing it to x11vnc #779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NodeBase/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
NODE_PID=$!

trap shutdown SIGTERM SIGINT
wait $NODE_PID
wait ${NODE_PID}
26 changes: 14 additions & 12 deletions NodeDebug/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,33 +52,35 @@ fi

rm -f /tmp/.X*lock

xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
# Creating a file descriptor, where the DISPLAY will be saved ("6" was arbitrarily chosen)
exec 6>/tmp/display.log
xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR -displayfd 6" \
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
-role node \
-hub http://$HUB_PORT_4444_TCP_ADDR:$HUB_PORT_4444_TCP_PORT/grid/register \
-hub http://${HUB_PORT_4444_TCP_ADDR}:${HUB_PORT_4444_TCP_PORT}/grid/register \
${REMOTE_HOST_PARAM} \
-nodeConfig /opt/selenium/config.json \
${SE_OPTS} &
NODE_PID=$!
exec 6>&-

trap shutdown SIGTERM SIGINT
for i in $(seq 1 10)
do
DISPLAY=$(xvfb-run printenv DISPLAY)
if [ -z "$DISPLAY" ]; then
echo "\$DISPLAY env variable is empty"
break
sleep 1
export DISPLAY=:$(cat /tmp/display.log)
if [ "${DISPLAY}" != ":" ]; then
echo "Display ${DISPLAY} allocated"
fi
xdpyinfo -display $DISPLAY >/dev/null 2>&1
xdpyinfo -display ${DISPLAY} >/dev/null 2>&1
if [ $? -eq 0 ]; then
break
fi
echo Waiting xvfb...
sleep 0.5
echo "Waiting xvfb..."
done

fluxbox -display $DISPLAY &
fluxbox -display ${DISPLAY} &

x11vnc $X11VNC_OPTS -forever -shared -rfbport 5900 -display $DISPLAY &
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${DISPLAY} &

wait $NODE_PID
wait ${NODE_PID}
2 changes: 1 addition & 1 deletion Standalone/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
NODE_PID=$!

trap shutdown SIGTERM SIGINT
wait $NODE_PID
wait ${NODE_PID}
24 changes: 13 additions & 11 deletions StandaloneDebug/entry_point.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,31 @@ fi

rm -f /tmp/.X*lock

xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR" \
# Creating a file descriptor, where the DISPLAY will be saved ("6" was arbitrarily chosen)
exec 6>/tmp/display.log
xvfb-run -a --server-args="-screen 0 $GEOMETRY -ac +extension RANDR -displayfd 6" \
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar \
${SE_OPTS} &
NODE_PID=$!
exec 6>&-

trap shutdown SIGTERM SIGINT
for i in $(seq 1 10)
do
DISPLAY=$(xvfb-run printenv DISPLAY)
if [ -z "$DISPLAY" ]; then
echo "\$DISPLAY env variable is empty"
break
sleep 1
export DISPLAY=:$(cat /tmp/display.log)
if [ "${DISPLAY}" != ":" ]; then
echo "Display ${DISPLAY} allocated"
fi
xdpyinfo -display $DISPLAY >/dev/null 2>&1
xdpyinfo -display ${DISPLAY} >/dev/null 2>&1
if [ $? -eq 0 ]; then
break
fi
echo Waiting xvfb...
sleep 0.5
echo "Waiting xvfb..."
done

fluxbox -display $DISPLAY &
fluxbox -display ${DISPLAY} &

x11vnc $X11VNC_OPTS -forever -shared -rfbport 5900 -display $DISPLAY &
x11vnc ${X11VNC_OPTS} -forever -shared -rfbport 5900 -display ${DISPLAY} &

wait $NODE_PID
wait ${NODE_PID}