Trying to modify run.sh so it waits for the Xvfb server to start accepting connections.
This commit is contained in:
parent
29bd8d2fe8
commit
d17a6cc23b
1 changed files with 4 additions and 2 deletions
6
run.sh
6
run.sh
|
@ -12,6 +12,8 @@ while [ ${p} -lt 3000 ]
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
let timeout=20
|
||||||
|
|
||||||
if [ "${port}" != "" ]; then
|
if [ "${port}" != "" ]; then
|
||||||
echo "The display port will be ${port}."
|
echo "The display port will be ${port}."
|
||||||
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background \
|
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background \
|
||||||
|
@ -19,14 +21,14 @@ if [ "${port}" != "" ]; then
|
||||||
-ac +extension GLX +render -noreset
|
-ac +extension GLX +render -noreset
|
||||||
|
|
||||||
# Wait to be able to connect to the port. This will exit if it cannot in 15 minutes.
|
# 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"
|
timeout ${timeout} bash -c "while ! nc -z localhost ${port}; do sleep 0.5; done"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
export DISPLAY=:${port}.0
|
export DISPLAY=:${port}.0
|
||||||
|
|
||||||
cd /data
|
cd /data
|
||||||
node /usr/src/app/ -p 80 "$@"
|
node /usr/src/app/ -p 80 "$@"
|
||||||
else
|
else
|
||||||
echo "Could not connect to display port ${port} in 15 seconds time."
|
echo "Could not connect to display port ${port} in ${timeout} seconds time."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Could not get a display port."
|
echo "Could not get a display port."
|
||||||
|
|
Loading…
Reference in a new issue