ubuntu - 为 supervisord 没有人用户导出环境变量

标签 ubuntu supervisord

我使用 supervisord 来运行像 celery 这样的应用程序。

我使用nobody 用户来运行这些应用程序。但他们找不到环境变量。

例如,这是我使用nobody 用户的celery.conf。当我用 supervisord 运行 celery 时,它找不到我之前设置的 DJANGO_SETTINGS_MODULE 环境变量。

; ==================================                                                    
;  celery worker supervisor                                                             
; ==================================                                                    

[program:celery]                                                                        
command=/home/ubuntu/pl_env/bin/celery worker -A config --loglevel=INFO                 
directory=/home/ubuntu/petroline_django                                                 

user=nobody                                                                             
numprocs=1                                                                              
stdout_logfile=/var/log/celery/worker.log                                               
stderr_logfile=/var/log/celery/worker.log                                               
autostart=true                                                                          
autorestart=true                                                                        
startsecs=10                                                                            

; Need to wait for currently executing tasks to finish at shutdown.                     
; Increase this if you have very long running tasks.                                    
stopwaitsecs = 600                                                                      

; Causes supervisor to send the termination signal (SIGTERM) to the whole process group.
stopasgroup=true                                                                        

; Set Celery priority higher than default (999)                                         
; so, if rabbitmq is supervised, it will start first.                                   
priority=1000     

最佳答案

我找到了environment设置 supervisord configuration file , 可以用来解决这个问题。

关于ubuntu - 为 supervisord 没有人用户导出环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59504804/

相关文章:

Ubuntu 17.04 - 无法安装 mysql-server-5.6

nginx - 错误(没有这样的过程)Nginx+Gunicorn+Supervisord

php - Laravel Queue with Supervisor,运行但不处理作业

mongodb - 如何在 Ubuntu 16.04 中自动重启 Mongodb

celery - 从 Supervisor 停止 Celery 工作时出现 WorkerLostError

shell - 如果默认 CMD 是 shell 脚本,则 Docker 停止退出代码 -1

由于 "GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline",JavaFX 程序未启动

ubuntu - 在安装包中避免 'sudo apt install'

python - 如何安装/修复在 python 3.4 上运行但在 3.5 上不起作用的失败的 numpy 安装?

linux - 我无法使用 composer 在 Symfony 中安装某些东西