본문 바로가기
Ubuntu

[Ubuntu] supervisor 프로세스 관리

by lllIIl 2023. 3. 28.

개인적으로 운영하는 봇들이 있는데 가끔 예기치 못한 오류 발생으로 프로그램이 종료되는 경우가 있었다.

자동으로 재실행할 수 있는 패키지를 찾다가 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