supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user

https://www.cnblogs.com/52fhy/p/10161253.html 附一个supervisor使用教程
supervisorctl start echo_time 启动进程失败

/etc/supervisor ⌚ 13:50:32
//启动子进程
$ supervisorctl start echo_time
echo_time: ERROR (spawn error)
//查看进程状态
$ supervisorctl status
echo_time                        FATAL     Exited too quickly (process log may have details)

查看日志
tail -f /usr/local/var/log/supervisord.log

2021-09-23 14:27:20,221 INFO spawned: 'echo_time' with pid 658
2021-09-23 14:27:20,230 INFO exited: echo_time (exit status 127; not expected)

在配置文件中添加错误日志
vim /etc/supervisor/conf.d/echo_time.conf

stderr_logfile=/tmp/echo_time.stdout.err.log

然后再tail -f echo_time.stdout.err.log重启进程观察日志

supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user
supervisor: child process was not spawned

原因是在启动supervisord时的用户不是当前启动进程的用户
解决办法

//用root启动supervisord
sudo supervisord -c /etc/supervisor/supervisord.conf
//再用root启动子进程
sudo supervisorctl start echo_time
image.png

关闭进程

sudo supervisorctl stop echo_time

你可能感兴趣的:(supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user)