Rykian / clockwork

A scheduler process to replace cron.
MIT License
544 stars 66 forks source link

Is it possible to run every hour at :00? #43

Open quoine-doug opened 6 years ago

quoine-doug commented 6 years ago

How can I make it always run cleanly at :00? Also, is it possible to make it run every in a day, BUT run the last one at :59

Epigene commented 6 years ago

Your question is unclear. Let me try and help you.

What do you mean by "at :00"? If you mean at the turn of every hour, try this

every(1.day, "Test job", at: "**:00", skip_first_run: true) { SomeJob.add }

Making the last one run differently can make things much harder. Perhaps something like this:

(0..22).to_a.each do |hour|
  every(1.day, "Test job", at: "#{hour}:00", skip_first_run: true) { SomeJob.add }
end

every(1.day, "Test job", at: "23:59", skip_first_run: true) { SomeJob.add }
morgoth commented 3 years ago

@quoine-doug Can this be closed?