/usr/share/backgroundrb/server/lib/trigger.rb is in libbackgroundrb-ruby1.8 1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | module BackgrounDRb
class Trigger
attr_accessor :start_time, :end_time, :repeat_interval
def initialize(opts={})
@start_time = Time.parse(opts[:start])
@end_time = Time.parse(opts[:end])
@repeat_interval = opts[:repeat_interval].to_i
end
def fire_after_time(time)
@start_time = time if not @start_time
# Support UNIX at-style scheduling, by just specifying a start
# time.
if @end_time.nil? and @repeat_interval.nil?
@end_time = start_time + 1
@repeat_interval = 1
end
case
when @end_time && time > @end_time
nil
when time < @start_time
@start_time
when @repeat_interval != nil && @repeat_interval > 0
time + @repeat_interval - ((time - @start_time) % @repeat_interval)
end
end
end
end
|