TJ_Log

[Linux] 리눅스 명령어 Systemctl 이란 본문

STUDY/Linux

[Linux] 리눅스 명령어 Systemctl 이란

PTJ 2022. 5. 26. 15:50

1. Systemctl이란?

- RHEL7(Red Hat Enterprise Linux)에 도입된 systemd(=init system)를 관리하는 명령어다

 

- /usr/lib/systemd/system 디렉토리의 .service파일을 systemctl 명령어로 Unit을 제어할 수 있다.

(Unit = 서비스, 마운트 포인트, 디바이스, 소켓 등을 포괄하는 개념)

 

Systemd 상태 모니터링 명령어

  • systemctl status : 실행중인 유닛 상태 정보 출력 , control group으로 묶어서 보여줌

  • systemctl : 로딩된 유닛을 출력, Unit파일 이름/활성화 상태/상세 설명 등 디테일한 정보 제공
    (==systemctl list-units)

  • systemctl list-unit-files : 설치된 유닛을 출력, 로딩되지 않았더라도 유닛 파일로 있는 모든 서비스를 출력

Systemd 유닛 컨트롤 명령어

  • systemctl start [unit] :  유닛 활성화

  • systemctl stop [unit] : 유닛 비활성화

  • systemctl restart [unit] : 유닛을 종류 후 재활성화

  • systemctl enable [unit] : 유닛 등록

  • systemctl disable [unit] : 유닛 등록 해제

  • systemctl enable --now [unit] : 유닛 등록 및 활성화

  • systemctl mask [unit] : 유닛 마스킹 (동작 안되게 함)

  • systemctl unmaske [unit] : 유닛 마스킹 해제