Supervisord不能够启动进程的问题

今天在启动某应用的时候,发现supervisord会报错「spawn error」,开始以为是进程问题,后面直接通过python启动时发现没有问题,所以锁定应该是supervisord的问题,经过查supervisord的配置文件/etc/supervisord.conf,查到配置文件地址在/tmp,所以去/tmp看日志

看报错

root@localhost:/tmp# more ss-manyuser-stderr---supervisor-BLAHBLAH.log 
supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user
supervisor: child process was not spawned
supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user
supervisor: child process was not spawned
supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user
supervisor: child process was not spawned
supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user
supervisor: child process was not spawned

分析

可能是没有权限,查阅google,得到同样的答案。

所以,将配置文件的user改为root

[supervisord] user=root

善后

注意在启动supervisord的时候,需要加上-c /etc/supervisord.conf指定配置文件地址。同样的,如果需要开机启动,/etc/rc.local中也需要加上。