supervisord 常用操作 运行python脚本

Published on Aug. 22, 2023, 12:11 p.m.

how toinstall

apt-get install supervisor

[program:my_server]
command=python /path/to/server.py
directory=/path/to/server/
autostart=true
autorestart=true
stdout_logfile=/var/log/server.log
stderr_logfile=/var/log/server_error.log
user=your_linux_user_name

复制配置

cp supervisord.conf /etc/supervisor/conf.d
supervisorctl reload

查看状态

supervisord

服务操作

sudo service supervisor stop
sudo service supervisor start
sudo service supervisor restart

“Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting supervisord.”:

sudo unlink /tmp/supervisor.sock
sudo unlink /var/run/supervisor.sock

http://supervisord.org/