]> git.openstreetmap.org Git - chef.git/commitdiff
nominatim: fix more syntax errors and enable new archive remover
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 18 Nov 2015 13:46:02 +0000 (14:46 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 18 Nov 2015 13:46:02 +0000 (14:46 +0100)
cookbooks/nominatim/templates/default/clean-db-nominatim.erb
cookbooks/nominatim/templates/default/cron.erb

index 2930e151d2465d225db1789ca4d3acd0a8c4299f..0e54e1cc1fc6b14831d3789c456775a7d3094deb 100644 (file)
@@ -3,15 +3,6 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
 
 # DO NOT EDIT - This file is being maintained by Chef
 
 
-# Vaccum all tables with indices on integer arrays.
-# Agressive vacuuming seems to help against index bloat.
-psql -q -d nominatim -c 'VACUUM ANALYSE search_name'
-psql -q -d nominatim -c 'VACUUM ANALYSE search_name_country'
-
-for i in `seq 0 246`; do
-  psql -q -d nominatim -c "VACUUM ANALYSE search_name_${i}"
-done
-
 # Cleanup archive directory
 oldest=`date +%s`
 
 # Cleanup archive directory
 oldest=`date +%s`
 
@@ -32,15 +23,18 @@ done
 if [[ "$oldest" != "0" ]]; then
     now=`date +%s`
     timeago=$(( ( $now - $oldest ) / 60 + 180 ))
 if [[ "$oldest" != "0" ]]; then
     now=`date +%s`
     timeago=$(( ( $now - $oldest ) / 60 + 180 ))
-    if [[ "$timeago" -le "180" ]]; then
+    if [[ "$timeago" -lt "180" ]]; then
         echo "Oldest is in the future, something is wrong."
         echo "Oldest is in the future, something is wrong."
-        exit(1)
-    fi
+    else
+      if [[ "$timeago" -le "720" ]]; then
+          timeago=720
+      fi
 
 
-    echo "find -L <%= @archive_dir %> -mmin +$timeago -print0 | xargs -0r rm"
+      find -L <%= @archive_dir %> -mmin +$timeago -print0 | xargs -0r rm
+    fi
 fi
 
 fi
 
-diskfree=`df --output=pcent <%= @archive_dir %> | tail -n 1 | sed s:[^0-9.]::g
+diskfree=`df --output=pcent <%= @archive_dir %> | tail -n 1 | sed s:[^0-9.]::g`
 
 if [[ "$diskfree" -lt 10 ]]; then
     echo "WAL archives running out of space. Stopping updates."
 
 if [[ "$diskfree" -lt 10 ]]; then
     echo "WAL archives running out of space. Stopping updates."
index 956a2d7869329a6b9986c7c188a182a1e938f3b7..68961e54e93fe25904e660a22bc7aa6fc2819408 100644 (file)
@@ -7,3 +7,6 @@ MAILTO=<%= @mailto %>
 00 3 1 * * nominatim /usr/local/bin/backup-nominatim
 <% end -%>
 30 1 * * * postgres /usr/local/bin/vacuum-db-nominatim
 00 3 1 * * nominatim /usr/local/bin/backup-nominatim
 <% end -%>
 30 1 * * * postgres /usr/local/bin/vacuum-db-nominatim
+<% if node[:postgresql][:settings][:defaults][:archive_mode] == "on" -%>
+05 */4 * * * postgres /usr/local/bin/clean-db-nominatim
+<% end -%>