From: Tom Hughes Date: Sun, 6 Oct 2013 09:18:26 +0000 (+0100) Subject: Don't warn when the tile cleanup script can't get a lock X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/23b6f6fb29fba9c2a7f9e6d9bf8d1ece35bc66f2?ds=sidebyside Don't warn when the tile cleanup script can't get a lock --- diff --git a/cookbooks/tile/templates/default/cleanup-tiles.erb b/cookbooks/tile/templates/default/cleanup-tiles.erb index 9209a2644..0f9bff288 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 => 0, -warn => 0); + +$lockmgr->lock($tiledir) || exit 0; my $tempfile = tmpnam(); @@ -49,6 +51,6 @@ if (df($tiledir)->{per} > 90) unlink($tempfile); -unlock($tiledir); +$lockmgr->unlock($tiledir); exit 0;