class Hookit::Resource::Cron

Public Class Methods

new(name) click to toggle source
Calls superclass method
# File lib/hookit/resource/cron.rb, line 5
def initialize(name)
  super
  timeout 60
  cwd '/data'
end

Protected Instance Methods

run!() click to toggle source
# File lib/hookit/resource/cron.rb, line 13
def run!
  begin
    Timeout::timeout(timeout) do
      f = IO.popen("#{cmd} || exit 0", :err=>[:child, :out])
      puts f.readline while true
    end
  rescue Timeout::Error
    $stderr.puts 'Timed out running cron! Consider using a worker.'
  end
end