purge_tmp_terds: a sewage system for /tmp

This commit is contained in:
Kyle Drake 2016-08-16 12:14:56 -07:00
parent 444f8a5bd0
commit a75a02d653

View file

@ -403,3 +403,10 @@ task :renew_ssl_certs => [:environment] do
delay += 10
end
end
desc 'purge_tmp_turds'
task :purge_tmp_turds => [:environment] do
['neocities_screenshot*', 'RackMultipart*', 'neocities_saving_file*', 'newinstall-*', '*.dmp', 'davfile*'].each do |target|
Dir.glob("/tmp/#{target}").select {|filename| File::Stat.new(filename).ctime < (Time.now - 3600)}.each {|filename| FileUtils.rm(filename)}
end
end