supervisor :a running process with pid = 0,程序PID为0

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_44266650/article/details/101543230

Today stepped on a pit supervisor's
Here Insert Picture Description
post as shown above, this situation, trying to stop this process, or restart it or even stop all this way, as shown below (part of the mosaic process name): Here Insert Picture Description
a: Background

The deployment of several separate programs running on the server, using the supervisor to manage. supervisor of installation, configuration, operation and so on, Neo king will not repeat them, Baidu to go to a lot. Here only a few useful commands that I used.

#启动supervisor, supervisord.conf为配置文件
supervisord -c xxx/supervisord.conf

#supervisord.conf 部分配置
[program:program-name]
command = /root/program-name.sh ;启动程序的脚本(位置自定义)
numprocs = 1        ;number of processes copies to start
autostart = true    ;在 supervisord 启动的时候也自动启动
autorestart = true    ;程序异常退出后自动重启
startretries = 10    ;启动失败自动重试次数,默认是 3
startsecs = 10        ;启动 10 秒后没有异常退出,就当作已经正常启动了
stopsignal = KILL    ;干掉进程的信号,默认为TERM
redirect_stderr=true    ;把 stderr 重定向到 stdout,默认 false
exitcodes = 0,2        ;进程退出码,autorestart=unexpected时有用
stdout_logfile=/program-name/logs/program-name.log ;日志输出目录(可自定义)

#supervisorctl 是supervisord的客户端,可以管理进程,常用命令
status    # 查看程序状态
start program-name  # 启动程序
stop program-name   # 关闭 程序
restart program-name    # 重启程序
reread    # 读取有更新(增加)的配置文件,不会启动新添加的程序
update    # 重启配置文件修改过的程序

II: Question: PID program 0

Replaced by a new version of the program when re-start a program, find the beginning of a problem.

Three: to solve

Directly or restart the entire service supervisor ------- following
through inquiry found that the problem seems to be due, caused by file permissions. Neo Jun configured at configuration time a log output directory:

stdout_logfile=/program-name/logs/program-name.log ;日志输出目录(可自定义)

However, when the new deployment project, no logs directory, no logs folder, ie / program-name /, then start when the newspaper made a mistake

supervisor>
supervisor> start program-name
error: <class 'xmlrpclib.ProtocolError'>, <ProtocolError for 127.0.0.1/RPC2: 500 Internal Server Error>: file: /usr/lib/python2.6/site-packages/supervisor-3.1.3-py2.6.egg/supervisor/xmlrpc.py line: 470

View program becomes a pid = 0. However, there is no way to stop, Neo king to kill the process (if there is any good method to stop please advise).

Create folders, add the code to create logs directory in the startup script. You can refer to

if [ ! -e "$base_home/logs" ] ; then
        mkdir "$base_home/logs"
fi

Guess you like

Origin blog.csdn.net/weixin_44266650/article/details/101543230