From 99de8efe8964e72593996423f1854379c1d5781d Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Thu, 9 Jul 2020 01:22:18 +0100 Subject: [PATCH] tilecache: compress old curl time records --- cookbooks/tilecache/recipes/default.rb | 7 +++++-- cookbooks/tilecache/templates/default/cron.erb | 1 + .../templates/default/tilecache-curl-time-cleanup.erb | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 cookbooks/tilecache/templates/default/tilecache-curl-time-cleanup.erb diff --git a/cookbooks/tilecache/recipes/default.rb b/cookbooks/tilecache/recipes/default.rb index 16a8af1be..22272b3aa 100644 --- a/cookbooks/tilecache/recipes/default.rb +++ b/cookbooks/tilecache/recipes/default.rb @@ -206,8 +206,11 @@ template "/srv/tilecache/tilecache-curl-time" do variables :caches => tilecaches, :renders => tilerenders end -file "/srv/tilecache/tilecache-fastest-peers" do - action :delete +template "/srv/tilecache/tilecache-curl-time-cleanup" do + source "tilecache-curl-time-cleanup.erb" + owner "root" + group "root" + mode 0o755 end ohai_plugin "tilecache" do diff --git a/cookbooks/tilecache/templates/default/cron.erb b/cookbooks/tilecache/templates/default/cron.erb index f510ad735..ab8ad8397 100644 --- a/cookbooks/tilecache/templates/default/cron.erb +++ b/cookbooks/tilecache/templates/default/cron.erb @@ -2,3 +2,4 @@ 0 * * * * root /usr/local/bin/nginx_generate_tilecache_qos_map * * * * * www-data /srv/tilecache/tilecache-curl-time +15 0 * * * www-data /srv/tilecache/tilecache-curl-time-cleanup diff --git a/cookbooks/tilecache/templates/default/tilecache-curl-time-cleanup.erb b/cookbooks/tilecache/templates/default/tilecache-curl-time-cleanup.erb new file mode 100644 index 000000000..3be4267dc --- /dev/null +++ b/cookbooks/tilecache/templates/default/tilecache-curl-time-cleanup.erb @@ -0,0 +1,3 @@ +#/bin/bash +set -eu +/usr/bin/find /srv/tilecache/data/ -type f -iname '*.txt' -mtime +7 -print0 | /usr/bin/xargs -0 -n 12 --no-run-if-empty -P 2 /usr/bin/xz -9e -- 2.39.5