Sha256: bb696bc85aa18f0d2d4b69f0f1601b4b849f3c3998d2326af33fae5dd785d57c

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

module Myreplicator
  class Sweeper
   
    @queue = :myreplicator_sweeper # Provided for Resque
    
    ##
    # Main method provided for resque
    # Reconnection provided for resque workers
    ##
    def self.perform
      Myreplicator::Log.clear_deads
      Myreplicator::Log.clear_stucks
      Myreplicator::Log.clear_olds
      ActiveRecord::Base.configurations.keys.each do |db|
        Myreplicator::VerticaLoader.clean_up_temp_tables(db)
      end
      
      #removing files that are left in the storage for more than 12 hours
      folders = [
        "/home/share/datareplicator",
        "/home/share/okl/bi_apps/datareplicator/mysqldumps"]
        
      folders.each do |folder|
        cmd = "find #{folder} -mmin +720"
        l = `#{cmd}`
        list = l.split(/\n/)
        list.each do |file|
          file.chomp!
          if File.file?(file)
            if (file.split('.').last == 'gz') || (file.split('.').last == 'json')
              puts "=== #{file}"
              File.delete(file)
            end
          end
        end
      end

    end
    
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
myreplicator-1.1.71 app/models/myreplicator/sweeper.rb
myreplicator-1.1.69 app/models/myreplicator/sweeper.rb
myreplicator-1.1.68 app/models/myreplicator/sweeper.rb
myreplicator-1.1.67 app/models/myreplicator/sweeper.rb
myreplicator-1.1.66 app/models/myreplicator/sweeper.rb
myreplicator-1.1.65 app/models/myreplicator/sweeper.rb
myreplicator-1.1.64 app/models/myreplicator/sweeper.rb
myreplicator-1.1.63 app/models/myreplicator/sweeper.rb
myreplicator-1.1.62 app/models/myreplicator/sweeper.rb
myreplicator-1.1.61 app/models/myreplicator/sweeper.rb