关于主管的错误

时间:2017-02-03 06:10:14

标签: python supervisord supervisor

操作系统:macOS Sierra10.12.3

我通过'brew install supervisor'安装了主管,并试图用它来管理我的python程序:

import get_weibo
import time

while(True):

    get_weibo.get_all()
    time.sleep(60*60*6)

get_weibo在控制台中运行。这不是问题

并且主管的配置在这里

[supervisord]
logfile=/usr/local/var/log/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10           ; (num of main logfile rotation backups;default 10)
loglevel=info                ; (log level;default info; others: debug,warn,trace)
pidfile=/usr/local/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false               ; (start in foreground if true;default false)
minfds=1024                  ; (min. avail startup file descriptors;default 1024)
minprocs=200                 ; (min. avail process descriptors;default 200)
umask=022                   ; (process file creation umask;default 022)
user=root ; (default is current user, required if root)
identifier=supervisor       ; (supervisord identifier, default is 'supervisor')
directory=/tmp              ; (default is not to cd during start)
nocleanup=true              ; (don't clean up tempfiles at start;default false)
childlogdir=/tmp            ; ('AUTO' child log dir, default $TEMP)
environment=KEY="value"     ; (key value pairs to add to environment)
strip_ansi=false            ; (strip ansi escape codes in logs; def. false)



[program:weibopics]
command=python /Users/HirosueRyouko/PycharmProjects/Supervisor_Py/keep_weibo_pics.py              ; the program (relative uses PATH, can take args)
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1                    ; number of processes copies to start (def 1) directory to cwd to before exec (def no cwd)
umask=022                     ; umask for process (default None)
priority=600                  ; the relative start priority (default 999)
autostart=true                ; start at supervisord start (default: true)
startsecs=1                   ; # of secs prog must stay up to be running (def. 1)
startretries=3                ; max # of serial start failures when starting (default 3)
autorestart=true           ; when to restart if exited after running (def: unexpected)
exitcodes=2                   ; 'expected' exit codes used with autorestart (default 0,2)
stopsignal=QUIT               ; signal used to kill process (default TERM)
stopwaitsecs=10               ; max num secs to wait b4 SIGKILL (default 10)
stopasgroup=false             ; send stop signal to the UNIX process group (default false)
killasgroup=false             ; SIGKILL the UNIX process group (def false)
user=nobody                     ; setuid to this UNIX account to run the program
redirect_stderr=true          ; redirect proc stderr to stdout (default false)
stdout_logfile=/Users/HirosueRyouko/PycharmProjects/Supervisor_Py/weibo_pics_output.log        ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
stdout_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
stdout_events_enabled=false   ; emit events on stdout writes (default false)
stderr_logfile=/Users/HirosueRyouko/PycharmProjects/Supervisor_Py/weibo_pics_error.log          ; stderr log path, NONE for none; default AUTO
stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
stderr_logfile_backups=10     ; # of stderr logfile backups (default 10)
stderr_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
stderr_events_enabled=false   ; emit events on stderr writes (default false)
environment=A="1",B="2"       ; process environment additions (def no adds)
serverurl=AUTO                ; override serverurl computation (childutils)

这是命令行中的输入。

  

guangmoliangzideMacBook:~HirosueRyouko $ supervisord -c /etc/supervisord.conf

然后我在主管状态中得到了这个: Supervisor Status

尾巴:

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

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

您可以尝试在命令中使用sudo ...阅读错误...无法将权限作为非root用户删除

或在此处阅读running without root

说修改user=变量的设置方式。喜欢完全评论