Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a Whenever job at different hours every day

Tags:

ruby

whenever

I'm trying to set a Whenever job that should be executed 2 times a day, exactly at 11am and 11pm. Is there any way to do it with only one block? I mean something like this:

every :day, :at => ['11am','11pm'] do
  runner "Task"
end
like image 722
Gawyn Avatar asked Oct 24 '12 21:10

Gawyn


1 Answers

Whenever now supports the syntax proposed in the question.

Just pass an array to the :at option.

every :day, at: ["11am", "11pm"] do
  runner "Task"
end
like image 181
Ryan McGeary Avatar answered Oct 20 '22 09:10

Ryan McGeary