Files
document-haness/.agents/skills/writing-practitioner-guides/references/linux-systemd.md
T
DongHyeonkaandClaude Opus 5 ab59130196 chore: 이전 세션이 남긴 변경을 커밋한다
이번 파이프라인 작업과 무관하게 작업 트리에 남아 있던 것을 그대로 올린다.
사용자가 「전부 커밋」으로 정했고, 이번 작업과 섞이지 않게 커밋만 나눴다.

대부분은 clean-architecture-backend-template 의 그림 정본 재배치다 —
final/assets/diagrams/<이름>/ 에 있던 것이 CLAUDE.md 가 적은 배치인
final/assets/<이름>/ 로 옮겨졌고 .techviz/<이름>/ 이 함께 들어왔다.
삽입 줄의 대부분(3.15M)이 그 .techviz context.json 이다.

그 밖에 ca-tmpl·document-haness 의 정리, .claude/agents/ 열한 개,
writing-practitioner-guides 스킬, .playwright-mcp 세션 산출물,
scripts/check-ssot-facts.py 와 그 시험이 들어 있다.

이 커밋의 내용은 내가 만든 것이 아니라 이전 세션이 남긴 것이고 검증하지 않았다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 11:02:02 +09:00

52 lines
1.9 KiB
Markdown

# Linux · systemd — what to reach for first
## 서비스 상태
```bash
systemctl status <unit> # 상태 · Main PID · CGroup · 최근 로그
systemctl is-active <unit> # 한 단어. 스크립트용
systemctl cat <unit> # 유닛 파일에 적힌 것
systemctl show <unit> # 기본값까지 합쳐 실제 적용되는 것
```
`cat``show` 는 다르다. `Restart=on-failure` 만 적혀 있어도 `show`
`RestartUSec`·`StartLimitBurst` 같은 기본값을 함께 보여 준다.
## 로그
```bash
journalctl -u <unit> -n 50 # 최근 50줄
journalctl -u <unit> -e # 끝으로 (페이저)
journalctl -u <unit> -f # 실시간
journalctl -u <unit> -p err # 에러만
journalctl -u <unit> --since '1 hour ago'
journalctl -u <unit> -o json # 메타데이터까지
```
긴 줄이 접히면 `less -S` 로 좌우 스크롤한다.
**nginx 에러 로그는 2048바이트에서 잘린다**(`NGX_MAX_ERROR_STR`). 저널
포맷을 바꿔도 안 늘어난다 — 기록 자체가 잘렸기 때문이다. access 로그에는
제한이 없으므로 그쪽을 본다.
## 프로세스 · 포트 · 자원
```bash
ps aux | grep <name>
ps -eo pid,ppid,etimes,lstart,args | grep <name> # 얼마나 오래 떠 있나
ss -lntp # 듣고 있는 TCP 포트 + 프로세스
lsof -i :8080
free -m
top / htop
```
## cgroup
```bash
systemd-cgls /system.slice/<unit>.service
cat /sys/fs/cgroup/system.slice/<unit>.service/memory.current
cat /sys/fs/cgroup/system.slice/<unit>.service/pids.current
```
`systemctl status``Memory:` `Tasks:` `CPU:` 가 여기서 읽은 값이다.
## nginx
```bash
nginx -t && systemctl reload nginx # -t 를 통과할 때만 reload
ps -eo pid,lstart,args | grep 'nginx: worker' # reload 판정은 워커 PID 로
```
reload 하면 마스터는 유지되고 워커만 새로 뜬다. 로그 문구가 아니라 이걸 본다.