Sha256: 4a196ce827a4174f401fa6b8041d76cc95a448a9f1b4a00c18af7a551f15536e

Contents?: true

Size: 537 Bytes

Versions: 5

Compression:

Stored size: 537 Bytes

Contents

class Eye::Checker::FileCTime < Eye::Checker

  # Check that file changes (log for example)
  # check :ctime, :every => 5.seconds, :file => "/tmp/1.log", :times => [3,5]

  param :file, [String], true

  def initialize(*args)
    super
    self.file = process.expand_path(file) if process && file
  end

  def get_value
    File.ctime(file) rescue nil
  end

  def human_value(value)
    if value == nil
      'Err'
    else
      value.strftime('%H:%M')
    end
  end

  def good?(value)
    value.to_i > previous_value.to_i
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eye-0.8.pre2 lib/eye/checker/file_ctime.rb
eye-0.8.pre lib/eye/checker/file_ctime.rb
eye-0.7 lib/eye/checker/file_ctime.rb
eye-0.7.pre lib/eye/checker/file_ctime.rb
eye-0.6.4 lib/eye/checker/file_ctime.rb