X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/8aa57233f9034b901d7a652bd6276d0d7c3ea4f0..b7c12630cb9de017d76fe60ff296534d6d061399:/cookbooks/nominatim/templates/default/clean-db-nominatim.erb diff --git a/cookbooks/nominatim/templates/default/clean-db-nominatim.erb b/cookbooks/nominatim/templates/default/clean-db-nominatim.erb index 202240e3f..921a60d09 100644 --- a/cookbooks/nominatim/templates/default/clean-db-nominatim.erb +++ b/cookbooks/nominatim/templates/default/clean-db-nominatim.erb @@ -3,20 +3,11 @@ # 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` -for fl in <% @streaming_clients %>; do - lastupdate=`wget -O - -q http://$fl/last_update.php` +for fl in <%= @streaming_clients %>; do + lastupdate=`wget -O - -q https://${fl}.openstreetmap.org/last_update.php` if [[ "$?" != "0" ]]; then oldest=0 break @@ -32,15 +23,18 @@ done 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." - 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 -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."