Linux

systemctl 명령어 정리

쓱은감자 2022. 7. 15. 16:56

systemctml 명령어

systemctl은 리눅스에서 동작하는 systemd(system daemon)을 관리하는 명령어 입니다.

사용 방법

  • 서비스 상태 확인
    • systemctl status <daemon_name>
  • 서비스 구동
    • systemctl start <daemon_name>
  • 서비스 재구동
    • systemctl restart <daemon_name>
    • systemctl reload <daemon_name>
      • restart와 다르게 데몬의 pid가 변경되지 않음
  • 서비스 중단
    • systemctl stop <daemon_name>
  • 서비스 부팅시 자동 시작
    • systemctl enable <daemon_name>
  • 서비스 마스킹
    • 잘못 설치한 데몬이 구동되지 않도록 하는 명령어
    • systemctl mask <daemon_name>
  • 서비스 마스킹 해제
    • systemctl unmask <daemon_name>
  • 서비스 목록 보기
    • systemctgl list-units
    • 설치된 모든 unit 파일을 보려면 list-unit-files 사용
    • enabled된 모든 서비스
      • systemctl list-units --state=enabled
    • 구동에 실패한 서비스
      • systemctl list-units --state=failed
    • 특정 서비스가 active 상태인지 조회
      • systemctl is-active <daemon_name>