]> git.openstreetmap.org Git - chef.git/commitdiff
Replace cron.d templates with cron_d resources
authorTom Hughes <tom@compton.nu>
Sun, 19 Jul 2020 18:00:43 +0000 (19:00 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 19 Jul 2020 18:00:43 +0000 (19:00 +0100)
cookbooks/civicrm/recipes/default.rb
cookbooks/civicrm/templates/default/cron.erb [deleted file]
cookbooks/db/recipes/backup.rb
cookbooks/db/templates/default/backup.cron.erb [deleted file]
cookbooks/dns/recipes/default.rb
cookbooks/dns/templates/default/cron.erb [deleted file]
cookbooks/donate/recipes/default.rb
cookbooks/donate/templates/default/cron.erb [deleted file]
cookbooks/letsencrypt/recipes/default.rb
cookbooks/letsencrypt/templates/default/cron.erb [deleted file]

index 7252f61f9e8f733a8383b036e36d17009a8522b6..246f66332b6267313554b7f64068273fe1e5ccae 100644 (file)
@@ -173,12 +173,11 @@ file "#{civicrm_directory}/civicrm.settings.php" do
   content settings
 end
 
-template "/etc/cron.d/osmf-crm" do
-  source "cron.erb"
-  owner "root"
-  group "root"
-  mode 0o600
-  variables :directory => civicrm_directory, :passwords => passwords
+cron_d "osmf-crm" do
+  minute "*/15"
+  user "www-data"
+  command "php #{civicrm_directory}/civicrm/bin/cli.php -s join.osmfoundation.org -u batch -p \"#{passwords['batch']}\" -e Job -a execute 2>&1 | egrep -v '^PHP (Deprecated|Warning):'"
+  mailto "admins@openstreetmap.org"
 end
 
 template "/etc/cron.daily/osmf-crm-backup" do
diff --git a/cookbooks/civicrm/templates/default/cron.erb b/cookbooks/civicrm/templates/default/cron.erb
deleted file mode 100644 (file)
index 22c3631..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# DO NOT EDIT - This file is being maintained by Chef
-
-MAILTO=admins@openstreetmap.org
-
-*/15 * * * * www-data php <%= @directory %>/civicrm/bin/cli.php -s join.osmfoundation.org -u batch -p "<%= @passwords["batch"] %>" -e Job -a execute 2>&1 | egrep -v '^PHP (Deprecated|Warning):'
index 5a814392a3243d482e2cd90a5ef8bfb11bfa0943..66ddd765de978b030d56aeace0d3aea0be178c59 100644 (file)
@@ -24,9 +24,11 @@ template "/usr/local/bin/backup-db" do
   mode 0o755
 end
 
-template "/etc/cron.d/backup-db" do
-  source "backup.cron.erb"
-  owner "root"
-  group "root"
-  mode 0o644
+cron_d "backup-db" do
+  minute "00"
+  hour "02"
+  weekday "1"
+  user "osmbackup"
+  command "/usr/local/bin/backup-db"
+  mailto "admins@openstreetmap.org"
 end
diff --git a/cookbooks/db/templates/default/backup.cron.erb b/cookbooks/db/templates/default/backup.cron.erb
deleted file mode 100644 (file)
index b7249c7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# DO NOT EDIT - This file is being maintained by Chef
-
-MAILTO=admins@openstreetmap.org
-
-00 02 * * 1 osmbackup /usr/local/bin/backup-db
index 4d21c21f76786eef06fceac503b10fea3f46475b..057daf55ccbd255ffa392ccedf13c836f28dadad 100644 (file)
@@ -144,9 +144,9 @@ template "/usr/local/bin/dns-check" do
   variables :passwords => passwords, :geoservers => geoservers
 end
 
-template "/etc/cron.d/dns" do
-  source "cron.erb"
-  owner "root"
-  group "root"
-  mode 0o644
+cron_d "dns" do
+  minute "*/3"
+  user "git"
+  command "/usr/local/bin/dns-check"
+  mailto "admins@openstreetmap.org"
 end
diff --git a/cookbooks/dns/templates/default/cron.erb b/cookbooks/dns/templates/default/cron.erb
deleted file mode 100644 (file)
index 58e9ed3..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# DO NOT EDIT - This file is being maintained by Chef
-
-MAILTO=admins@openstreetmap.org
-
-*/3 * * * * git /usr/local/bin/dns-check
index 1c36bfb1e03025826bf9b18bc7c7f9631fe2fa5c..7eaf47bdd1103560554ebeda2d7f679dfdddaafe 100644 (file)
@@ -82,12 +82,10 @@ apache_site "donate.openstreetmap.org" do
   template "apache.erb"
 end
 
-template "/etc/cron.d/osmf-donate" do
-  source "cron.erb"
-  owner "root"
-  group "root"
-  mode 0o600
-  variables :passwords => passwords
+cron_d "osmf-donate" do
+  minute "*/2"
+  user "donate"
+  command "cd /srv/donate.openstreetmap.org/scripts/; /usr/bin/php /srv/donate.openstreetmap.org/scripts/update_csv_donate2016.php"
 end
 
 template "/etc/cron.daily/osmf-donate-backup" do
diff --git a/cookbooks/donate/templates/default/cron.erb b/cookbooks/donate/templates/default/cron.erb
deleted file mode 100644 (file)
index 42d6c77..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# DO NOT EDIT - This file is being maintained by Chef
-*/2 * * * * donate cd /srv/donate.openstreetmap.org/scripts/; /usr/bin/php /srv/donate.openstreetmap.org/scripts/update_csv_donate2016.php
index a1df6819035b160a35a42580998811cdb8d3da6c..899ee1fc514e288d49e1d80d48c75d4fda113e2a 100644 (file)
@@ -175,9 +175,18 @@ template "/srv/acme.openstreetmap.org/bin/check-certificates" do
   variables :certificates => certificates
 end
 
-template "/etc/cron.d/letsencrypt" do
-  source "cron.erb"
-  owner "root"
-  group "root"
-  mode 0o644
+cron_d "letencrypt-renew" do
+  minute "00"
+  hour "*/12"
+  user "letsencrypt"
+  command "/srv/acme.openstreetmap.org/bin/renew"
+  mailto "admins@openstreetmap.org"
+end
+
+cron_d "letencrypt-check" do
+  minute "30"
+  hour "*/12"
+  user "letsencrypt"
+  command "/srv/acme.openstreetmap.org/bin/check-certificates"
+  mailto "admins@openstreetmap.org"
 end
diff --git a/cookbooks/letsencrypt/templates/default/cron.erb b/cookbooks/letsencrypt/templates/default/cron.erb
deleted file mode 100644 (file)
index 74a8ee0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# DO NOT EDIT - This file is being maintained by Chef
-
-MAILTO=admins@openstreetmap.org
-
-00 */12 * * * letsencrypt /srv/acme.openstreetmap.org/bin/renew
-30 */12 * * * letsencrypt /srv/acme.openstreetmap.org/bin/check-certificates