Commit 5b64558e authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

First fully working version: both Nominatim and Photon now follow Open Street...

First fully working version: both Nominatim and Photon now follow Open Street Map continuous updates :-)
parent 4dfcecb6
......@@ -4,29 +4,38 @@ service postgresql start
## Set up nominatim updates ###
#sudo -u nominatim ./src/build/utils/update.php --init-updates
#sudo -u nominatim ./src/build/utils/update.php --import-osmosis-all &
while true; do
starttime=$(date +%s)
result=`sudo -u nominatim ./src/build/utils/update.php --check-for-updates`
if [ "$result" = "Database up to date." ]; then
sleepy=300
echo "The Nominatim database in already up to date. Sleeping for ${sleepy}s..."
sleep $sleepy
else
sudo -u nominatim ./src/build/utils/update.php --init-updates
#sudo -u nominatim ./src/build/utils/update.php --check-for-updates
sudo -u nominatim ./src/build/utils/update.php --import-osmosis --no-index
curl http://photon:2322/api
isPhotonAlive=$?
curl http://photon:2322/nominatim-update
if [ $isPhotonAlive -ne 0 ]; then
sleepy=300
echo "Photon is not available. Sleeping for ${sleepy}s, in order to let Photon wake up..."
sleep $sleepy
continue
fi
#sudo -u nominatim ./src/build/utils/update.php --index
sudo -u nominatim ./src/build/utils/update.php --init-updates
sudo -u nominatim ./src/build/utils/update.php --import-osmosis --no-index
curl -v http://photon:2322/nominatim-update # this line triggers the Photon update following the Nominatim update
# sleep a bit if updates take less than 5 minutes
endtime=$(date +%s)
elapsed=$((endtime - starttime))
if [[ $elapsed -lt 300 ]]; then
sleepy=$((300 - $elapsed))
echo "Sleeping for ${sleepy}s..."
sleepy=1800
echo "Sleeping for ${sleepy}s, in order to let Photon update..."
sleep $sleepy
sudo -u nominatim ./src/build/utils/update.php --index
fi
done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment