-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-rebuild.sh
46 lines (38 loc) · 880 Bytes
/
docker-rebuild.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
#!/bin/bash
configPath="htdocs/config.ini";
if [ ! -f $configPath ]; then
cat >$configPath <<EOL;
## config.tpl.ini
[auth]
allowedIPs[] = 127.0.0.1
allowedIPs[] = 172.17.0.1
httpAuthUser = username
httpAuthPass = password
debug = on
[sensor]
debug = on
[fan]
# provider = jablotron
debug = on
[dummy]
debug = on
[jablotron]
debug=on
EOL
fi
name="luftdaten-api-fancontrol";
docker build -t $name .;
docker stop $name;
docker rm $name;
echo 'docker run -d --name $name -p 80 $name';
docker run -d --name $name -p 80 $name;
docker port $name;
sleep 2
port="$(docker port $name |grep 0.0.0.0|awk -F '0.0.0.0:' '{print $2}')"
function curlTest() {
echo "curl-test";
curl --data '{"sensordatavalues":[{"value_type":"SDS_P1","value":"1"},{"value_type":"SDS_P2","value":"2"}]}' http://127.0.0.1:$1/data.php -u username:password
}
curlTest $port;
sleep 1;
curlTest $port;