rufus cron job not working in Apache/Passenger

2019-04-12 01:21发布

问题:

I have a Rails app running on Apache/Passenger. It has a rufus-scheduler cron job that runs in the background and sends out notifications via email.

When I am running the app in development on the WEBrick server, the emails are sent like they are supposed to be sent.

When I start up the app in production on Apache/Passenger, the emails don't get sent. In the production logs it doesn't show any logs for rufus-scheduler.

I'm stuck in this problem. Your help will be appreciated, thank you in advance.

回答1:

The easiest solution is to set PassengerSpawnMethod to direct. The Phusion Passenger documentation explains why this solves it: http://www.modrails.com/documentation/Users%20guide%20Apache.html#spawning_methods_explained In particular, take a look at section "15.4. Smart spawning gotcha #2: the need to revive threads".