Support for every other hour with offset (1am, 3am, etc.)
waterjump opened this issue · 3 comments
waterjump commented
Hi,
I'm looking to create a cron output that runs a job every 2 hours, with a one hour offset. Example:
'0 1,3,5,7,9,11,13,15,17,19,21,23 * * *'
Is this supported? I tried something like this, but the hour value in the at
option is ignored:
Whenever::Output::Cron.new(2.hours, nil, at: '1:00 am')
=> "0 0,2,4,6,8,10,12,14,16,18,20,22 * * *"
Thanks.
liijunwei commented
Using crontab syntax along with crontab guru works great for me.
Try it. 😊
every '0 1,3,5,7,9,11,13,15,17,19,21,23 * * *' do
# your task
end
waterjump commented
Thanks. That is what I ended up doing - completely circumventing the Whenever::Output::Cron
interface. So I guess the answer to my original question is 'no'.
frenkel commented
Great solution. Could you close the issue? Thanks!