https://www.cnblogs.com/52fhy/p/10161253.html 附一個(gè)supervisor使用教程
supervisorctl start echo_time 啟動(dòng)進(jìn)程失敗
/etc/supervisor ? 13:50:32
//啟動(dòng)子進(jìn)程
$ supervisorctl start echo_time
echo_time: ERROR (spawn error)
//查看進(jìn)程狀態(tài)
$ 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)
在配置文件中添加錯(cuò)誤日志
vim /etc/supervisor/conf.d/echo_time.conf
stderr_logfile=/tmp/echo_time.stdout.err.log
然后再tail -f echo_time.stdout.err.log
重啟進(jìn)程觀察日志
supervisor: couldn't setuid to 0: Can't drop privilege as nonroot user
supervisor: child process was not spawned
原因是在啟動(dòng)supervisord時(shí)的用戶不是當(dāng)前啟動(dòng)進(jìn)程的用戶
解決辦法
//用root啟動(dòng)supervisord
sudo supervisord -c /etc/supervisor/supervisord.conf
//再用root啟動(dòng)子進(jìn)程
sudo supervisorctl start echo_time
image.png
關(guān)閉進(jìn)程
sudo supervisorctl stop echo_time