티스토리 뷰

CentOS 7

배포판 버전 확인

# grep . /etc/*-release


# rpm -qa *-release

서비스 관리

CentOS 7 부터 서비스 데몬 관리 방법이 달라졌다. 기존의 init system에서 systemd로 기본 시스템 관리 데몬이 변경되었기 때문이다.

서비스 예시 : elasticsearch / .service 확장자 생략 가능

서비스 등록


# systemctl mask elasticsearch.service

서비스 삭제


# systemctl unmask elasticsearch.service

서비스 상태 확인


# systemctl status elasticsearch.service

서비스 구동


# systemctl start elasticsearch.service

서비스 중지


# systemctl stop elasticsearch.service

서비스 재실행


# systemctl restart elasticsearch.service

부팅시 서비스 자동 시작


# systemctl enable elasticsearch.service

부팅시 서비스 자동 시작 비활성화


# systemctl disable elasticsearch.service

서비스 목록

  • 설치된 모든 unit파일


# systemctl list-unit-files
또는
# systemctl list-units

조건에 맞는 서비스

  • 구동에 실패한 서비스


# systemctl list-units --state=failed
  • 모든 active 서비스 목록


# systemctl list-units --state=active
  • 서비스중에 상대가 running인 목록


# systemctl list-units --type=service --state=running

특정서비스 상태조회

  • active 상태 조회


# systemctl is-active elasticsearch
  • enable 상태 조회(부팅시 실행되는 서비스인지)


# systemctl is-enabled elasticsearch

'ICT Eng > Linux' 카테고리의 다른 글

[Linux] CentOS 7 Time Zone 변경  (0) 2018.04.10
댓글