[英]Unable to start service with nohup due to 'INFO spawnerr: unknown error making dispatchers for 'app_name': EACCES'
I'm trying to start a service with supervisor, but I get an error saying 我正在尝试与主管一起开始服务,但我得到一个错误说
INFO spawnerr: unknown error making dispatchers for 'app_name': EACCES
INFO spawnerr:为'app_name'制作调度程序的未知错误:EACCES
Here's my supervisord.conf file: 这是我的supervisord.conf文件:
[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=50MB ; change these depending on how many logs
logfile_backups=10 ; you want to keep
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=true
minfds=1024
minprocs=200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock socket
[program:myscript]
command= python -u /home/ubuntu/appfolder/app_name.py
autostart=true
autorestart=unexpected
redirect_stderr=true
stdout_logfile=/var/log/app_name.log
I had the same issue - the celery sub program logs were being written in the logs subfolder under my app folder and turns out I had set the owner to www-user
while I was debugging an issue with Nginx. 我有同样的问题 - 芹菜子程序日志写在我的app文件夹下的logs子文件夹中,结果我在调试Nginx的问题时将所有者设置为
www-user
。 I changed the owner of the app folder back to ubuntu ( >> whoami
) 我将app文件夹的所有者更改回ubuntu(
>> whoami
)
sudo chown -R ubuntu:ubuntu /var/www/myapp/
to get it to work. 让它工作。
The problem is the permission for the log file With the user running supervisor you can create a "logs" folder in the same path of the supervisord.conf file and change: 问题是日志文件的权限使用用户运行管理程序,您可以在supervisord.conf文件的相同路径中创建“logs”文件夹并更改:
logfile=/tmp/supervisord.log
to 至
logfile=logs/supervisord.log
I get this error when running supervisord
in an unprivileged Docker container, when I attempt to have supervisord
run as a non-root user, using the [supervisord]
[user]
directive. 当我尝试让
supervisord
作为非root用户运行时,使用[supervisord]
[user]
指令时,在无特权的Docker容器中运行supervisord
时出现此错误。
This caused by docker #31243 where the container is started as root
then another user is created/switched-to (as per supervisord
changing to non-root) and the restrictive permissions on the container's stdin/stdout/stderr
via it's TTY. 这是由docker#31243引起的,其中容器以
root
身份启动,然后另一个用户被创建/切换到(根据supervisord
更改为非root用户)以及容器的stdin/stdout/stderr
的限制权限通过它的TTY。
My workaround is to add the non-root user to the tty
group eg useradd -G tty supervisord
, making-sure that you run with a tty eg docker run ... -t
or Docker Compose tty: true
. 我的解决方法是将非root用户添加到
tty
组,例如useradd -G tty supervisord
,确保你运行tty例如docker run ... -t
或Docker Compose tty: true
。
I had the same issue, I recommend doing the following 我有同样的问题,我建议做以下事情
Add user who runs the service. 添加运行该服务的用户。 user=youruser
用户= youruser
moving your log to a supervisor dir 将您的日志移动到主管目录
from: 从:
logfile=/tmp/supervisord.log
to: 至:
logfile=/var/log/supervisor/supervisord.log
The same goes to you pid file 你的pid文件也一样
pidfile=/tmp/supervisord.pid >> pidfile=/var/run/supervisor/supervisord.pid
Make both dirs 做两个dirs
mkdir /var/run/supervisor/
mkdir /var/log/supervisor/
then change the of the dir with 然后改变目录
chown youuser:youuser -R /var/log/supervisor/
If this dosen't work double check who can write on you log files and pid files. 如果这不工作,请仔细检查谁可以写你的日志文件和pid文件。
ls -l /var/log/supervisor/supervisord.log
If it still dosen't work try updating you supervisor 如果它仍然无法正常工作,请尝试更新您的主管
the error info indicate your app "app_name" may read or write a file which has no privileges. 错误信息表明您的应用程序“app_name”可能读取或写入没有权限的文件。
has you started supervisord with root, then switched to a specific user? 你有root用户启动supervisord,然后切换到特定用户吗? in this case, you may create file in your "app_name" with owner of root, but the specific user may not have the right privileges.
在这种情况下,您可以使用root用户在“app_name”中创建文件,但特定用户可能没有正确的权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.