Skip to content

Commit

Permalink
Switch tile cleanup to use a systemd timer
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Nov 23, 2022
1 parent 503a330 commit 6da8c71
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions cookbooks/tile/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -670,14 +670,31 @@
mode "755"
end

systemd_service "cleanup-tiles@" do
description "Cleanup old tiles for /%I"
exec_start "/usr/local/bin/cleanup-tiles /%I"
user "_renderd"
io_scheduling_class "idle"
sandbox true
read_write_paths "/%I"
end

systemd_timer "cleanup-tiles@" do
description "Cleanup old tiles for /%I"
on_boot_sec "30m"
on_unit_inactive_sec "60m"
randomized_delay_sec "10m"
end

tile_directories.each do |directory|
label = directory.gsub("/", "-")

cron_d "cleanup-tiles#{label}" do
minute "0"
user "_renderd"
command "ionice -c 3 /usr/local/bin/cleanup-tiles #{directory}"
mailto "[email protected]"
action :delete
end

service "cleanup-tiles@#{label[1..]}.timer" do
action [:enable, :start]
end
end

Expand Down

0 comments on commit 6da8c71

Please sign in to comment.