我想使用每當gem在我的RoR應用程序中運行預定作業。我運行了捆綁安裝,這是我schedule.rb:Ruby on Rails 4每當cron作業不工作時
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一些文檔,但我不知道這是什麼...對於
http://stackoverflow.com/questions/7548730/cron-job-not-working-in-whe-never-gem/13257752#13257752 – damoiser