From 29bd8d2fe8c30eb96599f9f1598a2535136d8b4e Mon Sep 17 00:00:00 2001 From: polar Date: Wed, 20 Sep 2017 12:21:36 -0400 Subject: [PATCH] Trying to modify run.sh so it waits for the Xvfb server to start accepting connections. --- run.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/run.sh b/run.sh index 005b4dc..2473548 100755 --- a/run.sh +++ b/run.sh @@ -20,10 +20,14 @@ if [ "${port}" != "" ]; then # Wait to be able to connect to the port. This will exit if it cannot in 15 minutes. timeout 15 bash -c "while ! nc -z localhost ${port}; do sleep 0.5; done" - export DISPLAY=:${port}.0 + if [ $? -eq 0 ]; then + export DISPLAY=:${port}.0 - cd /data - node /usr/src/app/ -p 80 "$@" + cd /data + node /usr/src/app/ -p 80 "$@" + else + echo "Could not connect to display port ${port} in 15 seconds time." + fi else echo "Could not get a display port." exit 1