主管和环境变量 [英] Supervisor and Environment Variables

查看:192
本文介绍了主管和环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



以下是一个配置代码片段。

  [程序:htNotificationService] 
priority = 2
#autostart = true
#autorestart = true
directory = / home / ubuntu / workspace / htFrontEnd / heythat / htsite
command = / usr / bin / python htNotificationService.py -service
stdout_logfile = / var / log / heythat / htNotificationService.log
redirect_stderr = true
environment = PATH = / home / ubuntu / workspace / htFrontEnd / heythat
stopsignal = QUIT

我尝试过以下操作:

  environment = PATH = / home / ubuntu / workspace / htFrontEnd / heythat 
environment = PYTHONPATH = $ PYTHONPATH:/ home / ubuntu / workspace / htFrontEnd / heythat
environment = PATH = / home / ubuntu / workspace / htFrontEnd / heythat,PYTHONPATH = $ PYTHONPATH:/ home / ubuntu / workspace / htFrontEnd / heythat

当我开始主管我得到

  htNotificationService:ERROR(异常终止)

我可以从shell启动通过设置python路径,但不是从主管。在日志中,我收到一条错误,表示无法找到导入。那么,如果主管工作,那将会解决。我甚至在/ etc / environment中有路径?



为什么主管不工作?

解决方案

参考现有的env vars是使用%(ENV_VARNAME)s



(请参阅https://github.com/Supervisor/supervisor/blob/master/supervisor/skel/sample.conf



设置多个环境变量通过用逗号分隔来完成



(请参阅 http://supervisord.org/subprocess.html#subprocess-environment



尝试:

  environment = PYTHONPATH = / opt / mypypath:%(ENV_PYTHONPATH)s,PATH = / opt / mypath:%(ENV_PATH)s 


I really don't know how to get supervisor to work with environment variables.

Below is a configuration snippet.

[program:htNotificationService]
priority=2
#autostart=true
#autorestart=true
directory=/home/ubuntu/workspace/htFrontEnd/heythat/htsite
command = /usr/bin/python htNotificationService.py -service
stdout_logfile=/var/log/heythat/htNotificationService.log
redirect_stderr=true
environment=PATH=/home/ubuntu/workspace/htFrontEnd/heythat
stopsignal=QUIT

I have tried the following:

environment=PATH=/home/ubuntu/workspace/htFrontEnd/heythat
environment=PYTHONPATH=$PYTHONPATH:/home/ubuntu/workspace/htFrontEnd/heythat
environment=PATH=/home/ubuntu/workspace/htFrontEnd/heythat,PYTHONPATH=$PYTHONPATH:/home/ubuntu/workspace/htFrontEnd/heythat

When I start supervisor I get

htNotificationService: ERROR (abnormal termination)

I can start from the shell by setting the python path, but not from supervisor. In the logs I get an error that says that an import can't be found. Well, that would be solved if supervisor would work. I even have the path in /etc/environments?

Why will supervisor not work?

解决方案

Referencing existing env vars is done with %(ENV_VARNAME)s

( see https://github.com/Supervisor/supervisor/blob/master/supervisor/skel/sample.conf )

Setting multiple environment variables is done by separating them with commas

( see http://supervisord.org/subprocess.html#subprocess-environment )

Try:

environment=PYTHONPATH=/opt/mypypath:%(ENV_PYTHONPATH)s,PATH=/opt/mypath:%(ENV_PATH)s

这篇关于主管和环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆