在使用定时的时候,开发环境,可以执行通过,在本地用生产模式启动也可以通过, 但是在生产环境,跟测试环境都不能执行通过。 错误:
Running via Spring preloader in process 1599
Please specify a valid ruby command or the path of a script to run.
Run 'bin/rails runner -h' for help.
uninitialized constant Rails::Command::RunnerCommand::GrabOrderManager
schedule.rb 文件配置
rails_env = ENV['RAILS_ENV'] || :production
set :environment, rails_env
set :output, 'log/cron.log'
every :day, :at => '01:00 am' do
runner "GrabOrderManager.statistics"
end
every :day, :at => '04:30 am' do
runner "GrabOrderManager.dynamic_done"
end
crontab -l
# Begin Whenever generated tasks for: /www/web/sshl/config/schedule.rb at: 2018-03-26 17:32:04 +0800
0 1 * * * /bin/bash -l -c 'cd /www/web/sshl && bundle exec bin/rails runner -e production '\''GrabOrderManager.statistics'\'' >> log/cron.log 2>&1'
30 4 * * * /bin/bash -l -c 'cd /www/web/sshl && bundle exec bin/rails runner -e production '\''GrabOrderManager.dynamic_done'\'' >> log/cron.log 2>&1'
# End Whenever generated tasks for: /www/web/sshl/config/schedule.rb at: 2018-03-26 17:32:04 +0800
求支援