5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-01 11:46:07 +00:00

feat: hacer limpieza de emergencia #12854

This commit is contained in:
f 2023-03-29 15:12:10 -03:00
parent 63e55f16af
commit 28c51cab01
3 changed files with 7 additions and 3 deletions

View file

@ -1,2 +1,3 @@
cleanup: bundle exec rake cleanup:everything
stats: bundle exec rake stats:process_all
emergency_cleanup: bundle exec rake cleanup:everything[7]

View file

@ -2,8 +2,7 @@
namespace :cleanup do
desc 'Cleanup sites'
task everything: :environment do
before = ENV.fetch('BEFORE', '30').to_i.days.ago
CleanupJob.perform_later(before)
task everything: :environment do |_, args|
CleanupJob.perform_later((args.extras.first || 30).to_i.days.ago)
end
end

View file

@ -13,3 +13,7 @@ check program stats
with path "/usr/bin/foreman run -f /srv/Procfile -d /srv stats" as uid "rails" gid "www-data"
every "0 1 * * *"
if status != 0 then alert
check filesystem root with path /
if space usage > 80% for 5 times within 15 cycles then alert
if space usage > 90% for 5 cycles then exec "/usr/bin/foreman run -f /srv/Procfile -d /srv emergency_cleanup" as uid "rails" gid "www-data"