X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/bb0b3ef68eeb29f499491d277e981c4c95a486d0..fa4726fe7b8c651544b41112c9dc045a51a86cae:/cookbooks/tile/templates/default/cleanup-tiles.erb diff --git a/cookbooks/tile/templates/default/cleanup-tiles.erb b/cookbooks/tile/templates/default/cleanup-tiles.erb index 8278545ae..eb108e95e 100644 --- a/cookbooks/tile/templates/default/cleanup-tiles.erb +++ b/cookbooks/tile/templates/default/cleanup-tiles.erb @@ -12,15 +12,15 @@ use LockFile::Simple; my $tiledir = shift @ARGV; -my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1, -hold => 0, -warn => 0); +my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1, -hold => 0, -warn => 0, -stale => 1); $lockmgr->lock("${tiledir}/cleanup") || exit 0; my $tempfile = tmpnam(); -if (df($tiledir)->{per} > 90) +if (df($tiledir)->{per} > 88) { - system("find", $tiledir, "-xdev", "-name", "lost+found", "-prune", "-o", "-type", "f", "-name", "*.meta", "-atime", "+10", "-fprintf", $tempfile, "%A@ %p\n"); + system("find", $tiledir, "-xdev", "-name", "lost+found", "-prune", "-o", "-type", "f", "-name", "*.meta", "-atime", "+3", "-fprintf", $tempfile, "%A@ %p\n"); open(TILES, "-|", "sort", "-n", $tempfile) || die "Can't open $tempfile: $!"; @@ -38,7 +38,7 @@ if (df($tiledir)->{per} > 90) for (my $dir = dirname($tile); $dir ne $tiledir; $dir = dirname($dir)) { - unlink($dir); + rmdir($dir); } } else