2014-01-30 00:21:38 -05:00
|
|
|
module Scheduler::Schedule
|
2014-03-14 13:02:21 -04:00
|
|
|
|
|
|
|
def daily(options=nil)
|
|
|
|
if options
|
|
|
|
@daily = options
|
|
|
|
end
|
|
|
|
@daily
|
|
|
|
end
|
|
|
|
|
2014-01-30 00:21:38 -05:00
|
|
|
def every(duration=nil)
|
2014-02-05 18:14:41 -05:00
|
|
|
if duration
|
|
|
|
@every = duration
|
|
|
|
if manager = Scheduler::Manager.current
|
|
|
|
manager.ensure_schedule!(self)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@every
|
|
|
|
end
|
|
|
|
|
2015-06-25 23:32:08 -04:00
|
|
|
# schedule job indepndently on each host (looking at hostname)
|
|
|
|
def per_host
|
|
|
|
@per_host = true
|
|
|
|
end
|
|
|
|
|
|
|
|
def is_per_host
|
|
|
|
@per_host
|
|
|
|
end
|
|
|
|
|
2014-02-05 18:14:41 -05:00
|
|
|
def schedule_info
|
|
|
|
manager = Scheduler::Manager.without_runner
|
|
|
|
manager.schedule_info self
|
|
|
|
end
|
|
|
|
|
|
|
|
def scheduled?
|
2014-03-14 13:02:21 -04:00
|
|
|
!!@every || !!@daily
|
2014-01-30 00:21:38 -05:00
|
|
|
end
|
|
|
|
end
|