From d64041e863fe325be5176e6b83098d2de3bc0051 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 27 Oct 2022 22:47:42 +0100 Subject: [PATCH] Use a systemd timer for DNS updates --- cookbooks/dns/metadata.rb | 1 + cookbooks/dns/recipes/default.rb | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/cookbooks/dns/metadata.rb b/cookbooks/dns/metadata.rb index fb1120681..521b38718 100644 --- a/cookbooks/dns/metadata.rb +++ b/cookbooks/dns/metadata.rb @@ -9,3 +9,4 @@ supports "ubuntu" depends "accounts" depends "apache" depends "git" +depends "systemd" diff --git a/cookbooks/dns/recipes/default.rb b/cookbooks/dns/recipes/default.rb index d7d038c30..11ae88e8a 100644 --- a/cookbooks/dns/recipes/default.rb +++ b/cookbooks/dns/recipes/default.rb @@ -169,9 +169,23 @@ template "/usr/local/bin/dns-check" do variables :passwords => passwords, :geoservers => geoservers end -cron_d "dns" do - minute "*/3" +systemd_service "dns-check" do + description "Rebuild DNS zones with GeoDNS changes" + exec_start "/usr/local/bin/dns-check" user "git" - command "/usr/local/bin/dns-check" - mailto "admins@openstreetmap.org" + private_tmp true + private_devices true + protect_system "strict" + protect_home true + read_write_paths "/var/lib/dns" +end + +systemd_timer "dns-check" do + description "Rebuild DNS zones with GeoDNS changes" + on_boot_sec "3m" + on_unit_active_sec "3m" +end + +service "dns-check.timer" do + action [:enable, :start] end -- 2.45.1