1 require 'configuration'
3 require 'database_check'
4 require 'website_check'
9 @store_path ||= File.expand_path(File.join(File.dirname(__FILE__), "..", "run", "check.dat"))
13 @@config = "checks.yml"
16 Configuration.load(@@config)
24 return unless !@config || @config.stale?
25 @config ||= self.class.config
26 @checks = @config.map do |check|
27 Kernel.const_get(check[:class]).new(check)
33 threads = @checks.map {|check| Thread.new { check.do_it } }
39 @checks.map(&:passed?).uniq == [ true ]
47 File.open(Checks.store_path, File::RDWR|File::CREAT, 0644) do |fp|
48 fp.flock(File::LOCK_EX)
51 fp.write(Marshal.dump(@checks))
53 fp.flock(File::LOCK_UN)
60 File.open(Checks.store_path, File::RDONLY|File::CREAT, 0644) do |fp|
61 fp.flock(File::LOCK_SH)
63 @checks = Marshal.load(fp.read)
64 fp.flock(File::LOCK_UN)
66 rescue Exception => err
75 @checks.count > 0 && @checks.map(&:passed?).uniq == [ true ] && @checks.map(&:stale?).uniq == [ false ]