From 57995a029cd7185564cfb3a24bf55354a0cf46fe Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 6 Oct 2013 10:24:13 +0100 Subject: [PATCH] Place lock file inside the tile directory --- cookbooks/tile/recipes/default.rb | 8 +++++++- cookbooks/tile/templates/default/cleanup-tiles.erb | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index b80dc01fb..03c850dc9 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -257,8 +257,14 @@ node[:tile][:styles].each do |name,details| end details[:tile_directories].each do |directory| + directory "#{directory[:name]}" do + owner "www-data" + group "www-data" + mode 0755 + end + directory[:min_zoom].upto(directory[:max_zoom]) do |zoom| - directory "#{directory[:name]}/#{zoom}" do + directory "#{directory[:name]}/#{zoom}" do owner "www-data" group "www-data" mode 0755 diff --git a/cookbooks/tile/templates/default/cleanup-tiles.erb b/cookbooks/tile/templates/default/cleanup-tiles.erb index 0f9bff288..5a954e295 100644 --- a/cookbooks/tile/templates/default/cleanup-tiles.erb +++ b/cookbooks/tile/templates/default/cleanup-tiles.erb @@ -13,7 +13,7 @@ my $tiledir = shift @ARGV; my $lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 0, -warn => 0); -$lockmgr->lock($tiledir) || exit 0; +$lockmgr->lock("${tiledir}/cleanup") || exit 0; my $tempfile = tmpnam(); @@ -51,6 +51,6 @@ if (df($tiledir)->{per} > 90) unlink($tempfile); -$lockmgr->unlock($tiledir); +$lockmgr->unlock("${tiledir}/cleanup"); exit 0; -- 2.39.5