【发布时间】:2014-01-12 00:05:34
【问题描述】:
我想使用 When gem 在我的 RoR 应用程序中运行计划作业。我运行捆绑安装,这是我的 schedule.rb:
every 1.minute do
runner "Event.executeEvents"
end
我的 Event.executeEvents 方法是一个简单的日志条目:
class Event < ActiveRecord::Base
def executeEvents
puts "executeEvents at [" + Time.now.inspect + "]"
end
end
如果我在命令行中执行whenever,我得到了这个:
$ whenever
* * * * * /bin/bash -l -c 'cd C:/dev/yanpyapi && bin/rails runner -e production '\''Event.executeEvents'\'''
## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.
什么都不执行。
我错过了什么?
我需要以某种方式对其进行初始化吗? 我读过一些关于 capistrano 和 RVM 的文档,但我不知道这是为了什么......
【问题讨论】:
标签: ruby-on-rails cron whenever