forked from JamesKBowler/fxcollect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunMainDocker.sh
More file actions
36 lines (30 loc) · 817 Bytes
/
runMainDocker.sh
File metadata and controls
36 lines (30 loc) · 817 Bytes
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
#!/usr/bin/env bash
# Script to run the python executable inside the container, cleaning up afterwards, passing down UNIX signals for graceful shutdown
# https://unix.stackexchange.com/questions/146756/forward-sigterm-to-child-in-bash
_term() {
echo "Caught SIGTERM signal!"
kill -TERM "$PID" 2>/dev/null
}
trap _term SIGTERM SIGINT
###
### Starting up services
###
service mysql start
if [ "$WITH_PHPMYADMIN" -gt "0" ]; then
service apache2 start
fi
cd /home/nonroot/fxcollect
export LD_LIBRARY_PATH=/home/nonroot/ForexConnectAPI/lib/:/usr/local/lib/:\$LD_LIBRARY_PATH
gosu nonroot python3 /home/nonroot/fxcollect/main.py &
PID=$!
wait $PID
trap - SIGTERM SIGINT
wait $PID
EXIT_STATUS=$?
###
### Cleaning up services
###
service mysql stop
if [ "$WITH_PHPMYADMIN" -gt "0" ]; then
service apache2 stop
fi