Linux(debian)下的Python程序守护进程

Beaglebone 上的Python程序意外终止 寻找守护进程将其拉起

安装supervisor

# apt-get install supervisor

# cd /etc/supervisor/

配置监控脚本

# cd conf.d
# vi restapp.conf

配置需要拉起的py程序

[program:restapp]
user=root
command=/usr/bin/python3 /.../aaa.py
# 要确认该目录已经存在
directory=/etc/local/supervisor
# 程序停止之后是否需要重新将其启动
autorestart=true
# 重新启动时等待的时间
startsecs=10
# 重启程序的次数
startretries=100

启动 与 重启

# supervisord
# supervisorctl update
# supervisorctl reload

posted on 2020-05-07 11:35  wangxiaobei2019  阅读(484)  评论(0编辑  收藏  举报

导航