3 # DO NOT EDIT - This file is being maintained by Chef
5 # Change to Nominatim directory
8 num_cpus=`cat /proc/cpuinfo | grep -c processor`
9 num_cpus=$((num_cpus - 2))
11 while [ ! -f "<%= @update_stop_file %>" ]
13 # Send output to the log (logrotatable)
14 exec >> <%= @logfile %> 2>&1
17 current_load=`cat /proc/loadavg | cut -f 2 -d ' ' | sed 's:\..*::'`
19 if [[ $current_load -lt $num_cpus ]]
26 ./utils/update.php --no-npi --import-osmosis --index-instances $INST
28 <% if node[:nominatim][:enable_git_updates] -%>
30 if git fetch origin; then
31 # will trigger recompilation if necessary
32 git merge origin/<%= @branch %>
34 echo "WARNING: git fetch failed."
39 # sleep a bit if updates take less than a minute
41 elapsed=$((endtime - starttime))
42 if [[ $elapsed -lt 60 ]]
44 sleepy=$((60 - $elapsed))
45 echo "Sleeping for ${sleepy}s..."