]> git.openstreetmap.org Git - chef.git/blob - cookbooks/nginx/templates/default/nginx-old-cache-cleanup.erb
09ce9a5b3fe1b69e9098e3e8e8ddbe14c8fc447e
[chef.git] / cookbooks / nginx / templates / default / nginx-old-cache-cleanup.erb
1 #!/bin/bash
2 set -e
3 /usr/bin/renice -n 19 $$ >/dev/null
4 /usr/bin/ionice -c 3 -p $$ >/dev/null
5 [[ -d "/var/cache/nginx/fastcgi-cache" ]] && /usr/bin/find /var/cache/nginx/fastcgi-cache/?/??/ -maxdepth 1 -type f -delete || true
6 [[ -d "/var/cache/nginx/fastcgi-cache" ]] && /usr/bin/find /var/cache/nginx/fastcgi-cache/ -maxdepth 2 -mindepth 2 -type d -wholename '*/?/??' -delete
7 [[ -d "/var/cache/nginx/fastcgi-cache" ]] && /usr/bin/find /var/cache/nginx/fastcgi-cache/ -maxdepth 1 -mindepth 1 -type d -wholename '*/?' -delete
8 [[ -d "/var/cache/nginx/proxy-cache" ]] && /usr/bin/find /var/cache/nginx/proxy-cache/?/??/ -maxdepth 1 -type f -delete  || true
9 [[ -d "/var/cache/nginx/proxy-cache" ]] && /usr/bin/find /var/cache/nginx/proxy-cache/ -maxdepth 2 -mindepth 2 -type d -wholename '*/?/??' -delete
10 [[ -d "/var/cache/nginx/proxy-cache" ]] && /usr/bin/find /var/cache/nginx/proxy-cache/ -maxdepth 1 -mindepth 1 -type d -wholename '*/?' -delete