From: Tom Hughes Date: Sun, 19 Jul 2020 18:00:43 +0000 (+0100) Subject: Replace cron.d templates with cron_d resources X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/e698e02106fc290ff3e530f5de66a91868a7f1f8 Replace cron.d templates with cron_d resources --- diff --git a/cookbooks/civicrm/recipes/default.rb b/cookbooks/civicrm/recipes/default.rb index 7252f61f9..246f66332 100644 --- a/cookbooks/civicrm/recipes/default.rb +++ b/cookbooks/civicrm/recipes/default.rb @@ -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 index 22c363169..000000000 --- a/cookbooks/civicrm/templates/default/cron.erb +++ /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):' diff --git a/cookbooks/db/recipes/backup.rb b/cookbooks/db/recipes/backup.rb index 5a814392a..66ddd765d 100644 --- a/cookbooks/db/recipes/backup.rb +++ b/cookbooks/db/recipes/backup.rb @@ -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 index b7249c7bc..000000000 --- a/cookbooks/db/templates/default/backup.cron.erb +++ /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 diff --git a/cookbooks/dns/recipes/default.rb b/cookbooks/dns/recipes/default.rb index 4d21c21f7..057daf55c 100644 --- a/cookbooks/dns/recipes/default.rb +++ b/cookbooks/dns/recipes/default.rb @@ -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 index 58e9ed323..000000000 --- a/cookbooks/dns/templates/default/cron.erb +++ /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 diff --git a/cookbooks/donate/recipes/default.rb b/cookbooks/donate/recipes/default.rb index 1c36bfb1e..7eaf47bdd 100644 --- a/cookbooks/donate/recipes/default.rb +++ b/cookbooks/donate/recipes/default.rb @@ -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 index 42d6c770f..000000000 --- a/cookbooks/donate/templates/default/cron.erb +++ /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 diff --git a/cookbooks/letsencrypt/recipes/default.rb b/cookbooks/letsencrypt/recipes/default.rb index a1df68190..899ee1fc5 100644 --- a/cookbooks/letsencrypt/recipes/default.rb +++ b/cookbooks/letsencrypt/recipes/default.rb @@ -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 index 74a8ee0a2..000000000 --- a/cookbooks/letsencrypt/templates/default/cron.erb +++ /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