我想使用Whenever gem在我的RoR应用程序中运行预定作业.我运行bundle install,这是我的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的文档,但我不知道这是什么...
你必须执行
whenever -i
将作业添加到crontab