Rufus Scheduler :first_in option unknown with cron

。_饼干妹妹 提交于 2019-12-10 10:34:38

问题


I am trying to use the Rufus Scheduler (within Dashing) to schedule a cron job, but also have it run once upon the server spinning up. I am following the readme here where it is saying to do the following:

scheduler.cron '00 14 * * *', :first_in => '3d' do
  # ... every day at 14h00, but start after 3 * 24 hours
end

When I try to do this, I get the following error in my job:

`cron': unknown option: :first_in (ArgumentError)

Has anyone come across this?


回答1:


Dashing is using rufus-scheduler 2.0.24 ( https://github.com/Shopify/dashing/blob/55f90939eae4d6eb64822fd3590f694418396510/dashing.gemspec#L24 ) which doesn't support the first_in feature for cron.

First_in was introduced for cron in rufus-scheduler 3.0.

It seems you're reading the rufus-scheduler 3.x documentation instead of the 2.x one.

The documentation for rufus-scheduler is at https://github.com/jmettraux/rufus-scheduler#rufus-scheduler , on top of it, there is the link to the 2.x documentation ( https://github.com/jmettraux/rufus-scheduler/blob/two/README.rdoc ). You'll have better luck there.

A 2.x alternative would be:

scheduler.in '3d' do
  scheduler.cron '00 14 * * *' do
    # ... every day at 1400
  end
end


来源:https://stackoverflow.com/questions/24392648/rufus-scheduler-first-in-option-unknown-with-cron

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!