主管的芹菜用户不正确

编程入门 行业动态 更新时间:2024-10-26 04:29:51
本文介绍了主管的芹菜用户不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一些用celery运行的定期任务(由supervisord守护进程)运行,但是在尝试为用户设置主目录中的目录后,我为supervisor的进程设置了一个权限被拒绝"错误.在查看正在运行的celery任务中的 os.environ 字典后,我注意到 USER var设置为"root",而不是我在supervised中设置的用户芹菜的配置.

I have some periodic tasks that I run with celery (daemonized by supervisord), but after trying to create a directory in the home dir for the user i setup for the supervisor'd process I got a "permission denied" error. After looking at the os.environ dict in a running celery task I noticed that the USER var is set to 'root' and not the user that I set up in my supervisord config for celery.

这是我的/usr/local/etc/supervisord.conf 的样子:

[unix_http_server] file=/tmp/supervisor.sock chmod=0777 [supervisord] logfile=/var/log/supervisord.log pidfile=/var/run/supervisord.pid [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=unix:///tmp/supervisor.sock [program:celery] command=/home/<USER>/.virtualenvs/sync/bin/celeryd --beat --loglevel=INFO environment=PYTHONPATH=/home/<USER>/apps/sync directory=/home/<USER>/apps/sync user=<USER> numprocs=1 stdout_logfile=/var/log/celeryd.log stderr_logfile=/var/log/celeryd.log autostart=true autorestart=true startsecs=10 stopwaitsecs = 30

可能是什么原因造成的?任何帮助将不胜感激!

What could be causing this? Any help would be super appreciated!

推荐答案

我相信这是由于您没有设置HOME和USER环境变量而引起的.如果您的子流程依赖于所设置的子流程,则在使用"user =选项时,这是必需的.

I believe this is caused by the fact that you didn't set the HOME and USER environment variables. This is necessary when using the "user=" option if your subprocess relies on those being set.

在子流程环境的受监管文档之后:

主管运行子进程时,supervisor不会执行任何外壳程序,因此不会更改环境变量(例如USER,PATH,HOME,SHELL,LOGNAME等)的默认值,也不会对其进行重新分配

No shell is executed by supervisord when it runs a subprocess, so environment variables such as USER, PATH, HOME, SHELL, LOGNAME, etc. are not changed from their defaults or otherwise reassigned

所以也许尝试:

environment=USER=<USER>,HOME=/home/<USER>,PYTHONPATH=/home/<USER>/apps/sync

更多推荐

主管的芹菜用户不正确

本文发布于:2023-11-25 15:58:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630395.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:芹菜   不正确   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!