supervisor
supervisord # 安装 # pip install supervisor echo_supervisord_conf echo_supervisord_conf > /etc/supervisord.conf echo -e "[include]\nfiles = /etc/supervisor/conf.d/*.conf" >> /etc/supervisord.conf mkdir -p /var/log/test mkdir -p /etc/supervisor/conf.d/ echo -e "[program:test] command=/data/apps/test/.venv/bin/python test.py directory=/data/apps/test/src/ user=root autostart=true autorestart=true stopasgroup=true stderr_logfile=/var/log/test/test.err.log stderr_logfile_maxbytes=1000MB stderr_logfile_backups=10 stdout_logfile=/var/log/test/test.out.log stdout_logfile_maxbytes=1000MB stdout_logfile_backups=10" > /etc/supervisor/conf.d/test.conf supervisord supervisorctl update 问题 # supervisorctl status http://localhost:9001 refused connection 问题 # 首次安装, 只pip install后直接使用很可能是没有配置文件… 写入配置后启动supervisord就好了 多安装问题 # 使用pip安装和apt安装的 supervisor 使用的不同路径的配置文件, 然后系统里就会跑两个supervisor, 就容易产生迷惑行为 systemd # 文件路径: /etc/systemd/system/{service_name}.service ...