clockwork https://github.com/tomykaira/clockwork
服务器环境运行下面的命令都不行,报错仍是 development
bin/clockwork clock.rb -e production
bin/clockwork clock.rb RAILS_ENV=production
本地的开发环境执行下面的命令,没有任何问题
bin/clockwork clock.rb
clock.rb 文件的代码
require 'clockwork'
require_relative './config/boot'
require_relative './config/environment'
module Clockwork
every(1.day, 'solr.indexing', :at => '02:00') { SolrIndexingJob.perform_later }
end