forked from ibizaman/docker-ibcontroller
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
34 lines (29 loc) · 966 Bytes
/
start.sh
File metadata and controls
34 lines (29 loc) · 966 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
#!/bin/bash
conf=/etc/ibcontroller/conf.ini
# Force those values
export IB_ForceTwsApiPort=
export IB_IbBindAddress=127.0.0.1
export IB_IbDir=/var/run/ibcontroller/tws/conf
# thanks to kafka-docker for this wonderful snippet
for VAR in `env`; do
if [[ $VAR =~ ^IB_ ]]; then
name=`echo "$VAR" | sed -r "s/IB_(.*)=.*/\1/g"`
env_var=`echo "$VAR" | sed -r "s/(.*)=.*/\1/g"`
if egrep -q "(^|^#)$name=" $conf; then
sed -r -i "s@(^|^#)($name)=(.*)@\2=${!env_var}@g" $conf #note that no config values may contain an '@' char
else
echo "$name=${!env_var}" >> $conf
fi
fi
done
socat TCP-LISTEN:4003,fork TCP:127.0.0.1:4001&
/usr/sbin/xvfb-run \
--auto-servernum \
-f \
/var/run/xvfb/ \
java \
-cp \
/usr/share/java/ib-tws/jts.jar:/usr/share/java/ib-tws/total.jar:/usr/share/java/ibcontroller/ibcontroller.jar \
-Xmx512M \
ibcontroller.IBGatewayController \
$conf