X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/e1eee7937a3b5f480697025d783104f0a5711eb2..b7a7d93d6d9850c5ace31735c6a773e614f7d017:/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 9209a2644..eebcd41a4 100644 --- a/cookbooks/tile/templates/default/cleanup-tiles.erb +++ b/cookbooks/tile/templates/default/cleanup-tiles.erb @@ -7,11 +7,13 @@ use warnings; use File::Temp qw(tmpnam); use Filesys::Df; -use LockFile::Simple qw(lock unlock); +use LockFile::Simple; my $tiledir = shift @ARGV; -lock($tiledir) || exit 0; +my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1, -hold => 0, -warn => 0); + +$lockmgr->lock("${tiledir}/cleanup") || exit 0; my $tempfile = tmpnam(); @@ -49,6 +51,6 @@ if (df($tiledir)->{per} > 90) unlink($tempfile); -unlock($tiledir); +$lockmgr->unlock("${tiledir}/cleanup"); exit 0;