forked from acroca/osrm-docker
-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·38 lines (30 loc) · 842 Bytes
/
run.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
#!/bin/bash
DATA_PATH=${DATA_PATH:="/data"}
_sig() {
kill -TERM $child 2>/dev/null
}
trap _sig SIGKILL SIGTERM SIGHUP SIGINT EXIT
if [ "$PBF_RESOURCE" != "none" ]; then
echo "Using a PBF Resource.."
# Use environment PBF_RESOURCE
curl -o /pbf_resource.osm.pbf $PBF_RESOURCE
./osrm-extract /pbf_resource.osm.pbf
./osrm-prepare /pbf_resource.osrm
./osrm-routed /pbf_resource.osrm --max-table-size 8000 &
child=$!
wait "$child"
else
echo "Using data container.."
# Use data container.
if [ ! -f $DATA_PATH/$1.osrm ]; then
if [ ! -f $DATA_PATH/$1.osm.pbf ]; then
curl $2 > $DATA_PATH/$1.osm.pbf
fi
./osrm-extract $DATA_PATH/$1.osm.pbf
./osrm-prepare $DATA_PATH/$1.osrm
rm $DATA_PATH/$1.osm.pbf
fi
./osrm-routed $DATA_PATH/$1.osrm --max-table-size 8000 &
child=$!
wait "$child"
fi