Published 2022. 8. 2. 18:31

(Week 4 - Day 1) - (2/2)

(Week 4 - Day 2) - (1/2)

Systemd

- 기존의 init 프로세스를 대체하는 프로세스로 최신 리눅스에 도입된 PID 1번 프로세스

기능 및 특징

- init 프로세스에 대한 호환성 제공(제한적으로 접근성을 제공)

- systemd 유닛 사용

(service, socket, device)등의 unit이 있다.

- 시스템 부팅 시 서비스 병렬 시작

init이 스크립트 기반으로 하나하나씩 실행되었다면, 기존 Unix 철학에 위반되지만

현대 컴퓨터의 성능이 향상됨으로써 병렬로 변경되었다.

- 의존성 기반의 서비스 제어

Systemd 유닛 파일 구성

[Unit] 섹션

- 유닛에 대한 일반적인 정보

[Unit_type] 섹션

- 유닛 종류에 대한 정보

[Install] 섹션

- systemctl의 enable과 disable명령과 연관된 섹션

Systemd 유닛 종류

service unit device unit mount unit
automount unit swap unit target unit
timer unit snapshot unit  

Systemctl

- systemctl은 systemd유닛을 관리하는 명령이다.

- init 프로세스는 service 명령으로 서비스를 시작, 중지, 재시작과 같은 작업을 할 수 있었다.

- systemd에서의 서비스는 systemd 유닛의 일부이기 때문에 서비스를 시작하거나 중지,

활성화를 위해서 systemctl을 사용한다.

유닛의 실행상태 확인

systemctl list-units
systemctl list-units --type service
# systemd 전체 Unit 목록 확인(미설치 Systemd Unit 포함)
systemctl list-units --all
Systemd Unit의 부팅시 실행(활성화)여부 확인
# systemctl list-unit-files

유닛의 의존성 확인
# systemctl list-dependencies 유닛

Systemctl 사용

시작 systemctl start 유닛
중지 systemctl stop 유닛
상태확인 systemctl status 유닛
재시작 systemctl restart 유닛
활성화 systemctl enable 유닛
비활성화 systemctl disable 유닛
활성화확인 systemctl status 유닛
유닛 제어 명령 systemctl 서브커맨드 유닛
다시 읽기 systemctl reload 유닛
유닛 마스크 설정
# systemctl mask 유닛
* Systemd Unit을 수동 실행하거나 다른 Systemd Unit에 의한 실행까지 차단

유닛 마스크 설정 해제
# systemctl unmask 유닛

'Linux' 카테고리의 다른 글

[Linux] 18. 리눅스 부트 프로세스  (0) 2022.08.03
[Linux] 17. 로그 관리  (0) 2022.08.02
[Linux] 15. 논리 볼륨(LVM)  (0) 2022.08.01
[Linux] 14. 작업 스케줄링  (0) 2022.07.27
[Linux] 13. 고급 권한 관리  (0) 2022.07.26
복사했습니다!