天天看點

python supervisord_python – 以root身份啟動supervisord?

主管正在運作3.0:

pip freeze | grep supervisor

supervisor==3.0

從指令行啟動supervisord時:

sudo $VIRTENV/supervisord --nodaemon --configuration $PATH_TO_CONFIG/supervisord.conf

我得到這個錯誤:

2013-11-11 23:30:50,205 CRIT Supervisor running as root (no user in config file)

但是,如果沒有sudo,我不能啟動supervisord,它抱怨:

Error: Cannot open an HTTP server: socket.error reported errno.EACCES (13)

什麼是正确的方法來處理它?

(如果以root身份啟動它,則會收到相同的錯誤,但是在supervisord.conf中的[supervisord]部分下設定user = foobar)

更新:這是我的supervisord.conf

[unix_http_server]

file = /opt/run/supervisord.sock

[inet_http_server]

port = 9001

username = foobar

password = foobar

[rpcinterface:supervisor]

supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisord]

logfile = /opt/logs/supervisord.log

loglevel = debug

pidfile = /opt/run/supervisord.pid

[supervisorctl]

[program:foo1]

user = foobar

autostart = True

autorestart = True

command = foo1

stdout_logfile = /opt/logs/foo1.stdout.log

stderr_logfile = /opt/logs/foo1.stderr.log

stdout_logfile_maxbytes = 10MB

stderr_logfile_maxbytes = 10MB

[program:foo2]

user = foobar

autostart = true

autorestart = true

command = foo2

priority = 100

stdout_logfile_backups = 0

stderr_logfile_backups = 0

stdout_logfile_maxbytes = 10MB

stderr_logfile_maxbytes = 10MB

stdout_logfile = /opt/logs/foo2.stdout.log

stderr_logfile = /opt/logs/foo2.stderr.log