-
Notifications
You must be signed in to change notification settings - Fork 0
/
preheat.sh
executable file
·25 lines (19 loc) · 893 Bytes
/
preheat.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
#!/bin/bash
# Normally, the docker container will need to process data when it is started.
# This will cause a lot of time and redundant comutational effort to be wasted.
# So, we can preheat the docker images to avoid this problem. This script is
# part of the Dockerfile, and will be executed when the docker image is built.
echo "Preheating the docker image..."
# Run GraphHopper in the background.
java -Ddw.server.application_connectors[0].bind_host=0.0.0.0 \
-Ddw.server.application_connectors[0].port=8989 \
-Ddw.graphhopper.datareader.file=./map.osm \
-jar /graphhopper/*.jar \
server \
/graphhopper/config-bike.yml &
# Use CURL to wait for the server to start.
while ! curl -s localhost:8989; do sleep 1; done
# Stop the server.
kill $(ps aux | grep '[j]ava' | awk '{print $2}')
# The server is now ready to be used.
echo "GraphHopper is ready to be used."