khe*_*bie 4 rake ruby-on-rails whenever
我随时创建了cron作业(https://github.com/javan/whenever):
every 1.hours do
rake "scrape"
end
Run Code Online (Sandbox Code Playgroud)
当我手动运行时,rake scrape任务运行正常,但是当cron运行时,我得到:
rake aborted!
Could not find table 'beskeds'
Run Code Online (Sandbox Code Playgroud)
命令运行是:
/bin/bash -l -c 'cd /Users/klaus/Documents/src/Ruby/rails/fintra && RAILS_ENV=production bundle exec rake scrape --silent'
Run Code Online (Sandbox Code Playgroud)
我顺便使用RVM
好的,我现在明白了.事实证明我只在自己的计算机上运行这个站点并且没有生产环境,因此没有生产数据库......
每当配置应该是:
every 1.hours do
rake "scrape", environment => "development"
end
Run Code Online (Sandbox Code Playgroud)
我还必须在环境中运行:
whenever -w --set environment=development
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
561 次 |
| 最近记录: |