Move low zoom tile render to the last sunday of each month
authorTom Hughes <tom@compton.nu>
Sun, 7 Apr 2019 18:28:37 +0000 (19:28 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 7 Apr 2019 18:32:40 +0000 (19:32 +0100)
cookbooks/tile/recipes/default.rb
cookbooks/tile/templates/default/render-lowzoom.cron.erb [deleted file]

index 22a6426751693aefb1427a4ae5292ae6d2319cca..e090fd2bc7565a3eac96ac5e1e78d92170492b91 100644 (file)
@@ -532,11 +532,29 @@ template "/usr/local/bin/render-lowzoom" do
   mode 0o755
 end
 
-template "/etc/cron.d/render-lowzoom" do
-  source "render-lowzoom.cron.erb"
-  owner "root"
-  group "root"
-  mode 0o644
+systemd_service "render-lowzoom" do
+  description "Render low zoom tiles"
+  user "tile"
+  exec_start "/usr/local/bin/render-lowzoom"
+  private_tmp true
+  private_devices true
+  private_network true
+  protect_system "full"
+  protect_home true
+  no_new_privileges true
+end
+
+systemd_timer "render-lowzoom" do
+  description "Render low zoom tiles"
+  on_calendar "Sun *-*~07/1 01:00:00"
+end
+
+service "render-lowzoom.timer" do
+  action [:enable, :start]
+end
+
+file "/etc/cron.d/render-lowzoom" do
+  action :delete
 end
 
 package "liblockfile-simple-perl"
diff --git a/cookbooks/tile/templates/default/render-lowzoom.cron.erb b/cookbooks/tile/templates/default/render-lowzoom.cron.erb
deleted file mode 100644 (file)
index 73236c8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# DO NOT EDIT - This file is being maintained by Chef
-
-0 1 1-7 * * tile test $(date +\%u) -eq 7 && /usr/local/bin/render-lowzoom