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
 
  16     current_load=`cat /proc/loadavg | cut -f 2 -d ' ' | sed 's:\..*::'`
 
  18     if [[ $current_load -lt $num_cpus ]]
 
  25     ./nominatim replication --once --threads $INST
 
  27 <% if node[:nominatim][:enable_git_updates] -%>
 
  29     if git fetch origin; then
 
  30       # will trigger recompilation if necessary
 
  31       git merge origin/<%= @branch %>
 
  33       echo "WARNING: git fetch failed."
 
  38     if [ -f "<%= @update_maintenance_trigger %>" ]; then
 
  39         rm <%= @update_maintenance_trigger %>
 
  40         ./nominatim refresh --postcodes --word-tokens --threads 4 -v
 
  41 <% if node[:nominatim][:enable_qa_tiles] -%>
 
  42         pushd <%= @qabindir %>
 
  43         if python3 cli.py --execute-all; then
 
  44           rm -rf "<%= @qadatadir %>/old"
 
  45           if [ -d "<%= @qadatadir %>/current" ]; then
 
  46             mv "<%= @qadatadir %>/current" "<%= @qadatadir %>/old"
 
  48           mv "<%= @qadatadir %>/new" "<%= @qadatadir %>/current"