简体   繁体   English

Rufus Scheduler未在生产Nginx / Passenger中运行

[英]Rufus Scheduler not running in production Nginx/Passenger

I have a Rails app running on Nginx/Passenger. 我有一个在Nginx / Passenger上运行的Rails应用程序。 It has a rufus-scheduler cron job that runs in the background and sends out notifications via email. 它具有rufus-scheduler cron作业,该作业在后台运行,并通过电子邮件发送通知。

When I start up the app in production on Nginx/Passenger, the emails don't get sent. 当我在Nginx / Passenger上启动生产中的应用程序时,不会收到电子邮件。 In the production logs it doesn't show any logs for rufus-scheduler. 在生产日志中,它不显示rufus-scheduler的任何日志。

I'm stuck in this problem. 我陷入了这个问题。 Not able to debug the scheduler. 无法调试调度程序。

But after reading some issues & articles, I am sure that scheduler thread is kill on production by passenger. 但是在阅读了一些问题和文章之后,我确信调度程序线程会在乘客的生产中被杀死。

Code snippet: 程式码片段:

Example: 例:

require 'rufus-scheduler'

scheduler = Rufus::Scheduler::singleton

scheduler.cron '0 12 * * *' do
  puts "alert scheduler called at"
  puts Time.now
  system("rake trigger:email RAILS_ENV=production")
end

Kindly help me on the conf for the passenger/nginx that allow the scheduler thread to run & trigger the mails. 请帮助我在乘客/ nginx的conf上,它允许调度程序线程运行并触发邮件。

You need to set this in passanger config block 您需要在passanger配置块中进行设置

passenger_spawn_method direct; passenger_spawn_method直接;

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM