]> git.openstreetmap.org Git - chef.git/commitdiff
tilecache: compress old curl time records
authorGrant Slater <git@firefishy.com>
Thu, 9 Jul 2020 00:22:18 +0000 (01:22 +0100)
committerGrant Slater <git@firefishy.com>
Thu, 9 Jul 2020 00:22:18 +0000 (01:22 +0100)
cookbooks/tilecache/recipes/default.rb
cookbooks/tilecache/templates/default/cron.erb
cookbooks/tilecache/templates/default/tilecache-curl-time-cleanup.erb [new file with mode: 0644]

index 16a8af1be66f1f547e97a98307d048e8b0ca45c8..22272b3aa318ad91568304670bf7baee71aed9e1 100644 (file)
@@ -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
index f510ad73565204a6a9e6aadcfb8ef936827e9ce6..ab8ad8397abd80e17ea847feeceac32aea430a8f 100644 (file)
@@ -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 (file)
index 0000000..3be4267
--- /dev/null
@@ -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