]> git.openstreetmap.org Git - chef.git/commitdiff
Configure a timer to run geoipupdate weekly
authorTom Hughes <tom@compton.nu>
Thu, 20 Aug 2020 07:40:09 +0000 (08:40 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 20 Aug 2020 07:45:32 +0000 (08:45 +0100)
cookbooks/geoipupdate/metadata.rb
cookbooks/geoipupdate/recipes/default.rb

index 78d65c5fa7443a439a2902e8e7d89b8b065f60e7..ccc09f6261ddd230c09ca6b8ed4e88bc201a05e4 100644 (file)
@@ -7,3 +7,4 @@ description       "Installs and configures geoipupdate"
 version           "1.0.0"
 supports          "ubuntu"
 depends           "apt"
+depends           "systemd"
index 3b116c8691c60a9622fd82140c3fd76f0950db2c..27d6478ae7f118d796e65daf1bde19af090c0196 100644 (file)
@@ -51,6 +51,32 @@ execute "geoipupdate" do
   not_if { ENV.key?("TEST_KITCHEN") || node[:geoipupdate][:editions].all? { |edition| ::File.exist?("/usr/share/GeoIP/#{edition}.mmdb") } }
 end
 
+systemd_service "geoipdate" do
+  action :delete
+end
+
+systemd_service "geoipupdate" do
+  description "Update GeoIP databases"
+  user "root"
+  exec_start "/usr/bin/geoipupdate"
+  private_tmp true
+  private_devices true
+  protect_system "strict"
+  protect_home true
+  read_write_paths "/usr/share/GeoIP"
+end
+
+systemd_timer "geoipupdate" do
+  description "Update GeoIP databases"
+  on_boot_sec "15m"
+  on_unit_active_sec "7d"
+  randomized_delay_sec "4h"
+end
+
+service "geoipupdate.timer" do
+  action [:enable, :start]
+end
+
 directory "/var/lib/GeoIP" do
   action :delete
   recursive true