Place lock file inside the tile directory
authorTom Hughes <tom@compton.nu>
Sun, 6 Oct 2013 09:24:13 +0000 (10:24 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 6 Oct 2013 09:24:13 +0000 (10:24 +0100)
cookbooks/tile/recipes/default.rb
cookbooks/tile/templates/default/cleanup-tiles.erb

index b80dc01fb53c9793ae384abaa5af5b0076813562..03c850dc931ac3ddf365b9cbe72436f64851c7fd 100644 (file)
@@ -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
index 0f9bff288e16f0027a01828628efe1b5d185c4ca..5a954e2950117687c167a349ee5f3ecb9bef17d3 100644 (file)
@@ -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;