3 # DO NOT EDIT - This file is being maintained by Chef
8 use File::Temp qw(tmpnam);
12 my $tiledir = shift @ARGV;
14 my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1, -hold => 0, -warn => 0);
16 $lockmgr->lock("${tiledir}/cleanup") || exit 0;
18 my $tempfile = tmpnam();
20 if (df($tiledir)->{per} > 90)
22 system("find", $tiledir, "-xdev", "-name", "lost+found", "-prune", "-o", "-type", "f", "-name", "*.meta", "-atime", "+14", "-fprintf", $tempfile, "%A@ %p\n");
24 open(TILES, "-|", "sort", "-n", $tempfile) || die "Can't open $tempfile: $!";
26 while (df($tiledir)->{per} > 80)
30 if (defined(my $line = readline(TILES)))
34 my($time,$tile) = split(/ /, $line);
36 unlink($tile) || warn "Can't remove $tile: $!";
49 warn "Tile expiry finished before threshold reached" if df($tiledir)->{per} > 80;
54 $lockmgr->unlock("${tiledir}/cleanup");