-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.sh
33 lines (33 loc) · 900 Bytes
/
upload.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
#!/bin/bash
echo "$(java -Dserver.port=8083 -jar termite.jar -Dlog4j.configurationFile=/app/config/log4j2.xml)" &
p1=$!
(for i in {0..101}
do
if [ "$i" -eq 101 ]
then
echo "Failed to connect to Termite"
exit 1
fi
echo "Waiting for Termite ($i/100)"
result=$(curl -s --fail http://localhost:8083/fhir/metadata || exit 1)
exit_code=$?
echo "$result"
if [ "$exit_code" -eq 0 ]
then
break
fi
sleep 5
done
echo "Connected to Termite"
for json_file in value_sets/*.json
do
curl -svX POST -d @$json_file -H "Content-Type: application/json" "http://localhost:${TERMINOLOGY_SERVICE_PORT}/fhir/ValueSet"
echo "Uploading ${json_file}"
done
for json_file in code_systems/*.json
do
curl -svX POST -d @$json_file -H "Content-Type: application/json" "http://localhost:${TERMINOLOGY_SERVICE_PORT}/fhir/CodeSystem"
echo "Uploading ${json_file}"
done) &
p2=$!
wait $p1 $p2