]> git.openstreetmap.org Git - chef.git/blob - cookbooks/nominatim/templates/default/updater.erb
acadc9a02525cc93c2ee5fcd1485f66a78e00065
[chef.git] / cookbooks / nominatim / templates / default / updater.erb
1 #!/bin/bash -e
2
3 # DO NOT EDIT - This file is being maintained by Chef
4
5 # Send output to the log
6 exec >> /var/log/nominatim/update.log 2>&1
7
8 # Change to Nominatim directory
9 DIR="$( cd "$( dirname "$0" )" && pwd )"
10 cd $DIR/..
11
12 while true
13 do
14     starttime=`date +%s`
15
16     ./utils/update.php --no-npi --import-osmosis
17
18     # will trigger recompilation if necessary
19     if ! git pull; then
20       echo "WARNING: git update failed."
21     fi
22
23     # sleep a bit if updates take less than a minute
24     endtime=`date +%s`
25     elapsed=$((endtime - starttime))
26     if [[ $elapsed -lt 60 ]]
27     then
28         sleepy=$((60 - $elapsed))
29         echo "Sleeping for ${sleepy}s..."
30         sleep $sleepy
31     fi
32 done