Программе каким-то образом нужно учитывать прошедшее время с момента последнего запуска, чтобы повысить вероятность того, что она будет выполняться, чем дольше она не выполняется.Пример использования сна:
def diff_in_hours(time1, time2)
((time1 - time2) / 3600)
end
start = Time.now
loop do
hours_since_last_run = diff_in_hours(Time.now, start).to_i
# execution gets more and more likely the longer the last
# run is in the past
execute if [0, nil].include? rand(0..(24 - hours_since_last_run))
sleep(60*60) # sleep one hour
end