简体   繁体   English

对于 ruby on rails 3,在生产模式下不调用 Rake 任务

[英]Rake task is not called in production mode for ruby on rails 3

From a controller:-从 controller:-

call_rake :parse_venue, :venue_list_id => venue_list.id


def call_rake(task, options = {})
   options[:rails_env] ||= Rails.env
   args = options.map { |n, v| "#{n.to_s.upcase}='#{v}'" }
   system "rake #{task} #{args.join(' ')} --trace 2>&1 >> #{Rails.root}/log/rake.log &"
end 

In development mode this rake task is triggered.. But in case of production mode its not triggered.在开发模式下,此 rake 任务被触发。但在生产模式下,它不会被触发。

PS:- Inspired from rake in background, railscast . PS:- 灵感来自背景中的 rake,railscast There is nothing in rake.log file in production mode生产模式下 rake.log 文件中没有任何内容

Try the following system call:尝试以下系统调用:

system "#{args.join(' ')} rake #{task} --trace 2>&1 >> #{Rails.root}/log/rake.log &"

Verify that "rake" is in the $PATH of the user running your web server / app server验证“rake”是否在运行 web 服务器/应用服务器的用户的 $PATH 中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将通过 cron 任务调用的 Rails Rake 任务输出移植到 Rails 生产服务器输出? - How to port Rails Rake task output called via cron task to Rails production server output? Rails:如何在生产模式下从rake任务中写入自定义日志文件? - Rails: How to write to a custom log file from within a rake task in production mode? Rails rake 任务在生产中失败:“NoMethodError:为 URI:Module 调用私有方法‘open’” - Rails rake task fails just in production: "NoMethodError: private method `open' called for URI:Module" Ruby on Rails,rake db:seed或db:reset - 你如何决定哪种模式(开发/测试/生产)? - Ruby on Rails, rake db:seed or db:reset - how do you dictate which mode (development/test/production)? 在生产模式下登录 Ruby on Rails - Logging in Ruby on Rails in Production Mode Ruby on Rails-在rake任务中更改列值 - Ruby on Rails - Change column value in rake task Ruby On Rails-是否可以存储Rake Task的结果? - Ruby On Rails - Is it possible to store the result of a Rake Task? 在Rake任务中使用Ruby on Rails的“ upto”方法 - Using the Ruby on Rails 'upto' method in a Rake task Ruby on rails使用rake任务解析JSON文件 - Ruby on rails parse JSON file with rake task Ruby on Rails - Rake任务无法通过Cron工作 - Ruby on Rails - Rake task not working through Cron
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM