← 전체로 돌아가기
스킬 linux

pm2 백그라운드 앱

pm2로 백그라운드 앱 띄우고 관리하는 법

pm2background-processlinuxpythonserver

pm2로 실행할때:

pm2 start [app.py] --name "your-app-name" --interpreter ./venv/bin/python3.8
  • [app.py] : 실제 파이썬 파일 이름
  • --name "your-app-name" : pm2에서 뜰 이름, 식별용
  • --interpreter ./venv/bin/python3.8 : venv 환경 세팅

wtf how can i forget it

pm2 관리 명령어:

pm2 stop [name|id]
pm2 delete [name|id]
pm2 save
  • pm2 stop [name|id] : 프로세스 정지, 관리 목록엔 남음
  • pm2 delete [name|id] : 정지 후 관리 목록에서도 제거
  • pm2 save : 재부팅시 자동 부활 설정

여기서 배울 것

  1. pm2로 백그라운드 앱 띄우기
  2. pm2 프로세스 정지/삭제
  3. 재부팅시 앱 자동 부활 설정
원본 파일 보기 (.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

![Screen Shot 2024-01-07 at 4.46.19 PM.png](background%20launch%20in%20aws/Screen_Shot_2024-01-07_at_4.46.19_PM.png)

wtf how can i forget it

![Screen Shot 2024-01-07 at 4.50.59 PM.png](background%20launch%20in%20aws/Screen_Shot_2024-01-07_at_4.50.59_PM.png)

- **`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환경 세팅)