[英]How to run delayed_jobs in production environment
I am using delayed_job in rails application development and in development environment i use bin/delayed_job start
我在 rails 应用程序开发和开发环境中使用
bin/delayed_job start
我使用bin/delayed_job start
But how to do the same in production environment?但是如何在生产环境中做同样的事情呢?
RAILS_ENV=production bin/delayed_job start
这应该使延迟的作业在生产环境中运行
To start:开始:
cd /home/user/app;
bundle exec /usr/bin/env RAILS_ENV=production /home/user/app/script/delayed_job start
To stop:停止:
cd /home/user/app;
bundle exec /usr/bin/env RAILS_ENV=production /home/user/app/script/delayed_job stop
Refer to official documentation at github .请参阅github上的官方文档。
RAILS_ENV=production script/delayed_job start
RAILS_ENV=production script/delayed_job stop
# Runs two workers in separate processes.
RAILS_ENV=production script/delayed_job -n 2 start
RAILS_ENV=production script/delayed_job stop
# Set the --queue or --queues option to work from a particular queue.
RAILS_ENV=production script/delayed_job --queue=tracking start
RAILS_ENV=production script/delayed_job --queues=mailers,tasks start
# Use the --pool option to specify a worker pool. You can use this option multiple times to start different numbers of workers for different queues.
# The following command will start 1 worker for the tracking queue,
# 2 workers for the mailers and tasks queues, and 2 workers for any jobs:
RAILS_ENV=production script/delayed_job --pool=tracking --pool=mailers,tasks:2 --pool=*:2 start
# Runs all available jobs and then exits
RAILS_ENV=production script/delayed_job start --exit-on-complete
# or to run in the foreground
RAILS_ENV=production script/delayed_job run --exit-on-complete
如果其他人遇到 -bash: bin/delayed_job: Permission denied 错误,就像 Disha 在上面的评论中所做的那样,对于 Centos,将项目目录中 bin/ 文件夹中的 delay_job 设置为可执行文件就足够了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.