개인적으로 운영하는 봇들이 있는데 가끔 예기치 못한 오류 발생으로 프로그램이 종료되는 경우가 있었다.
자동으로 재실행할 수 있는 패키지를 찾다가 supervisor를 알게 되어 정리해 본다.
sudo apt-get update
sudo apt-get install -y supervisor
설치 후 /etc/superviosr/conf.d/ 경로에 설정 파일을 하나 만든다.
[program:ExampleProgramName]
command = python3 main.py
directory = /home/ubuntu/bot
autostart = yes
autorestart = yes
user = root
service supervisor restart
'Ubuntu' 카테고리의 다른 글
[Ubuntu] at 명령어로 원하는 시간 동안만 curl 다운로드 예약을 하자. (0) | 2023.04.24 |
---|---|
[Ubuntu] iptables 포트 관리 (0) | 2023.03.29 |
[Tvheadend] 기본 포트 변경하기 (0) | 2023.03.28 |
[Tvheadend] 적용되어 있는 EPG 초기화 하는 방법 (0) | 2023.03.28 |
[Tvheadend] Reverse Proxy with Nginx (0) | 2023.03.28 |