forked from RationaleEmotions/just-ask
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entry_point.sh
67 lines (56 loc) · 1.81 KB
/
entry_point.sh
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
echo "========================================================"
echo "Timezone Configuration"
echo "========================================================"
echo "${TZ}" | sudo tee /etc/timezone
sudo sh -c 'dpkg-reconfigure --frontend noninteractive tzdata 2>&1'
date
echo ""
echo "========================================================"
echo "Fix permissions"
echo "========================================================"
sudo chown -R seluser:seluser /opt/selenium/
echo "========================================================"
echo "Selenium Configuration"
echo "========================================================"
ROOT=/opt/selenium
if [ "$NODE_DEBUG" = "true" ]; then
export NODE_DEBUG_IMAGE="-debug"
else
export NODE_DEBUG_IMAGE=""
fi
if [ ! -z "$HUB_CONFIG" ]; then
echo "using provided hub configuration: ${HUB_CONFIG}"
else
echo "generate hub configuration..."
HUB_CONFIG=$ROOT/config.json
/opt/bin/generate_config >$HUB_CONFIG
fi
echo "starting selenium hub with configuration:"
cat $HUB_CONFIG
if [ ! -z "$SE_OPTS" ]; then
echo "appending selenium options: ${SE_OPTS}"
fi
function shutdown {
echo "shutting down hub.."
kill -s SIGTERM $NODE_PID
wait $NODE_PID
echo "shutdown complete"
}
echo "========================================================"
echo "java version"
echo "========================================================"
java -version 2>&1
echo ""
echo "========================================================"
echo "Start Hub ..."
echo "========================================================"
java ${GRID_JAVA_OPTS} \
-cp $ROOT/just-ask-jar-with-dependencies.jar:$ROOT/selenium-server-standalone.jar \
org.openqa.grid.selenium.GridLauncherV3 \
-role hub \
-hubConfig $HUB_CONFIG \
${SE_OPTS} &
NODE_PID=$!
trap shutdown SIGTERM SIGINT
wait $NODE_PID