Skip to content

Instantly share code, notes, and snippets.

@kovyrin
Created August 27, 2010 18:30
Show Gist options
  • Save kovyrin/553915 to your computer and use it in GitHub Desktop.
Save kovyrin/553915 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'fileutils'
Dir.chdir("/var/log/hadoop/userlogs") do
Dir.glob("attempt_2*") do |dir|
next unless File.readlines("#{dir}/syslog").last.match(/Task.*done/)
FileUtils.rm_rf("/var/log/hadoop/userlogs/#{dir}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment