munin_plugin "nginx_request"
munin_plugin "nginx_status"
+
+template "/usr/local/bin/nginx-old-cache-cleanup" do
+ source "nginx-old-cache-cleanup.erb"
+ owner "root"
+ group "root"
+ mode 0o755
+end
+
+template "/etc/cron.d/nginx-old-cache-cleanup" do
+ source "nginx-old-cache-cleanup.cron.erb"
+ owner "root"
+ group "root"
+ mode 0o644
+end
--- /dev/null
+#!/bin/bash
+set -e
+/usr/bin/renice -n 19 $$
+/usr/bin/ionice -c 3 -p $$
+[[ -d "/var/cache/nginx/fastcgi-cache" ]] && /usr/bin/find /var/cache/nginx/fastcgi-cache/?/??/ -maxdepth 1 -type f -delete || true
+[[ -d "/var/cache/nginx/fastcgi-cache" ]] && /usr/bin/find /var/cache/nginx/fastcgi-cache/ -maxdepth 2 -mindepth 2 -type d -wholename '*/?/??' -delete
+[[ -d "/var/cache/nginx/fastcgi-cache" ]] && /usr/bin/find /var/cache/nginx/fastcgi-cache/ -maxdepth 1 -mindepth 1 -type d -wholename '*/?' -delete
+[[ -d "/var/cache/nginx/proxy-cache" ]] && /usr/bin/find /var/cache/nginx/proxy-cache/?/??/ -maxdepth 1 -type f -delete || true
+[[ -d "/var/cache/nginx/proxy-cache" ]] && /usr/bin/find /var/cache/nginx/proxy-cache/ -maxdepth 2 -mindepth 2 -type d -wholename '*/?/??' -delete
+[[ -d "/var/cache/nginx/proxy-cache" ]] && /usr/bin/find /var/cache/nginx/proxy-cache/ -maxdepth 1 -mindepth 1 -type d -wholename '*/?' -delete