PM2 백그라운드 앱 실행 및 관리
PM2로 파이썬 앱 백그라운드 실행 및 관리
PM2는 파이썬 앱을 백그라운드에서 실행하고 관리하기 좋은 도구야. 특히 가상 환경(venv)을 지정해서 실행하는 방법을 알아두면 유용해.
PM2로 파이썬 앱 실행
pm2 start app.py --name "my-app" --interpreter ./venv/bin/python3.8
app.py: 실행 파일--name: PM2에서 쓸 이름--interpreter: 가상 환경 파이썬 경로
PM2 관리 명령어
pm2 stop <name|id>: 프로세스 중지 (관리 목록 유지)pm2 delete <name|id>: 프로세스 중지 및 PM2 목록에서 제거pm2 save: 현재 프로세스 목록 저장 (재부팅 시 자동 복구)
여기서 배울 것
- PM2로 파이썬 앱 백그라운드 실행 방법
- 가상 환경(venv) 인터프리터 지정하기
- PM2 프로세스 중지 및 삭제 명령어
- PM2 프로세스 목록 저장으로 재부팅 시 자동 복구
원본 파일 보기 (.claude/skills/tn-pm2-background-process/SKILL.md)
---
name: PM2 백그라운드 앱 실행 및 관리
description: Use when the user asks to run a Python application in the background using PM2, or manage PM2 processes such as stopping, deleting, or saving the process list.
version: 1.0.0
source: /home/son/prj/resume/backup_notes_260317/notion/Tech Note/background launch in aws 9ff6c502d22840a183bd6980b654556f.md
---
# background launch in aws
pm2

wtf how can i forget it

- **`pm2 stop <name|id>`**: Stops a process but does not remove it from management.
- **`pm2 delete <name|id>`**: Stops if necessary and removes a process from **`pm2`** management.
- **`pm2 save`**: Saves the current process list for automatic resurrection on reboot.
pm2로 실행할때 :
pm2 start [app.py](http://app.py/) --name "your-app-name" --interpreter ./venv/bin/python3.8
pm2 start [app.py](http://app.py/)(실제 파이썬파일 이름) --name "your-app-name"(pm2에서 뜰 이름, 식별용) --interpreter ./venv/bin/python3.8 (venv환경 세팅)