not_if { ENV["TEST_KITCHEN"] }
end
-template "/etc/cron.d/planet-update" do
- source "planet-update.cron.erb"
- owner "root"
- group "root"
- mode 0o644
+cron_d "planet-update" do
+ minute "17"
+ hour "1"
+ user "root"
+ command "/usr/local/bin/planet-update"
end
template "/etc/logrotate.d/planet-update" do
php-cli
]
-file "/etc/cron.d/planet" do
- action :delete
-end
-
remote_directory "/store/planet#html" do
path "/store/planet"
source "html"
mode 0o755
end
-template "/etc/cron.d/old-planet-file-cleanup" do
- source "old-planet-file-cleanup.cron.erb"
- owner "root"
- group "root"
- mode 0o644
+cron_d "old-planet-file-cleanup" do
+ comment "run this on the first monday of the month at 3:44am"
+ minute "44"
+ hour "3"
+ day "1-7"
+ user "www-data"
+ command "test $(date +\%u) -eq 1 && /usr/local/bin/old-planet-file-cleanup --debug"
+ mailto "zerebubuth@gmail.com"
end
no_new_privileges true
end
-template "/etc/cron.d/planet-dump-mirror" do
- source "planet-dump-mirror-cron.erb"
- owner "root"
- group "root"
- mode 0o644
+cron_d "planet-dump-mirror" do
+ minute "*/10"
+ user "www-data"
+ command "/usr/local/bin/planet-mirror-redirect-update"
+ mailto "horntail-www-data-cron@firefishy.com"
end
variables :password => db_passwords["planetdump"]
end
-template "/etc/cron.d/planet-notes-dump" do
- source "planet-notes-dump.cron.erb"
- owner "root"
- group "root"
- mode 0o644
+cron_d "planet-notes-dump" do
+ minute "0"
+ hour "3"
+ user "www-data"
+ command "/usr/local/bin/planet-notes-dump"
+ mailto "grant-smaug@firefishy.com"
+end
+
+cron_d "planet-notes-cleanup" do
+ comment "Delete Planet Notes dump files older than 8 days"
+ minute "10"
+ hour "8"
+ user "www-data"
+ command "find /store/planet/notes/20??/ -maxdepth 1 -type f -iname 'planet-notes-??????.osn*' -printf '\%T@ \%p\n' | sort -k 1nr | sed 's/^[^ ]* //' | tail -n +17 | xargs -r rm -f"
+ mailto "grant-smaug@firefishy.com"
end
end
if node[:planet][:replication] == "enabled"
- template "/etc/cron.d/replication" do
- source "replication.cron.erb"
- owner "root"
- group "root"
- mode 0o644
+ cron_d "users-agreed" do
+ minute "0"
+ hour "7"
+ user "planet"
+ command "/usr/local/bin/users-agreed"
+ mailto "zerebubuth@gmail.com"
+ end
+
+ cron_d "users-deleted" do
+ minute "0"
+ hour "17"
+ user "planet"
+ command "/usr/local/bin/users-deleted"
+ mailto "zerebubuth@gmail.com"
+ end
+
+ cron_d "replication-changesets" do
+ user "planet"
+ command "/usr/local/bin/replicate-changesets /etc/replication/changesets.conf"
+ mailto "zerebubuth@gmail.com"
+ end
+
+ cron_d "replication-minutely" do
+ user "planet"
+ command "/usr/local/bin/osmosis -q --replicate-apidb authFile=/etc/replication/auth.conf validateSchemaVersion=false --write-replication workingDirectory=/store/planet/replication/minute"
+ mailto "brett@bretth.com"
+ environment "LD_PRELOAD" => "/opt/flush/flush.so"
+ end
+
+ cron_d "replication-hourly" do
+ minute "2,7,12,17"
+ user "planet"
+ command "/usr/local/bin/osmosis -q --merge-replication-files workingDirectory=/var/lib/replication/hour"
+ mailto "brett@bretth.com"
+ environment "LD_PRELOAD" => "/opt/flush/flush.so"
+ end
+
+ cron_d "replication-daily" do
+ minute "5,10,15,20"
+ user "planet"
+ command "/usr/local/bin/osmosis -q --merge-replication-files workingDirectory=/var/lib/replication/day"
+ mailto "brett@bretth.com"
+ environment "LD_PRELOAD" => "/opt/flush/flush.so"
end
else
- file "/etc/cron.d/replication" do
+ cron_d "users-agreed" do
+ action :delete
+ end
+
+ cron_d "users-deleted" do
+ action :delete
+ end
+
+ cron_d "replication-changesets" do
+ action :delete
+ end
+
+ cron_d "replication-minutely" do
+ action :delete
+ end
+
+ cron_d "replication-hourly" do
+ action :delete
+ end
+
+ cron_d "replication-daily" do
action :delete
end
end
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-MAILTO=zerebubuth@gmail.com
-# run this on the first monday of the month at 3:44am
-44 3 1-7 * * www-data test $(date +\%u) -eq 1 && /usr/local/bin/old-planet-file-cleanup --debug
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-MAILTO=horntail-www-data-cron@firefishy.com
-*/10 * * * * www-data /usr/local/bin/planet-mirror-redirect-update
+++ /dev/null
-MAILTO=grant-smaug@firefishy.com
-0 3 * * * www-data /usr/local/bin/planet-notes-dump
-
-#Delete Planet Notes dump files older than 8 days
-10 8 * * * www-data find /store/planet/notes/20??/ -maxdepth 1 -type f -iname 'planet-notes-??????.osn*' -printf '\%T@ \%p\n' | sort -k 1nr | sed 's/^[^ ]* //' | tail -n +17 | xargs -r rm -f
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-17 1 * * * root /usr/local/bin/planet-update
+++ /dev/null
-# DO NOT EDIT - This file is being maintained by Chef
-
-TZ=UTC
-
-MAILTO=zerebubuth@gmail.com
-
-0 7 * * * planet /usr/local/bin/users-agreed
-0 17 * * * planet /usr/local/bin/users-deleted
-* * * * * planet /usr/local/bin/replicate-changesets /etc/replication/changesets.conf
-
-MAILTO=brett@bretth.com
-LD_PRELOAD=/opt/flush/flush.so
-
-* * * * * planet /usr/local/bin/osmosis -q --replicate-apidb authFile=/etc/replication/auth.conf validateSchemaVersion=false --write-replication workingDirectory=/store/planet/replication/minute
-2,7,12,17 * * * * planet /usr/local/bin/osmosis -q --merge-replication-files workingDirectory=/var/lib/replication/hour
-5,10,15,20 * * * * planet /usr/local/bin/osmosis -q --merge-replication-files workingDirectory=/var/lib/replication/day