많이 사용하는 systemctl  명령어를 정리한 페이지입니다. 전체 내용을 보려면 systemd(system daemon) 을 관리하는 systemctl 명령어 사용법 를 참고하세요.

서비스 상태 확인

status 명령어 뒤에 확인할 서비스 명을 주고 실행하면 됩니다.

systemctl status 서비스명
BASH


예로 다음은 nginx 서비스의 상태를 출력합니다.

systemctl status nginx

systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/nginx.service.d
           └─php71-php-fpm.conf, php72-php-fpm.conf, php73-php-fpm.conf, php74-php-fpm.conf, php80-php-fpm.conf
   Active: active (running) since Sun 2021-04-11 11:28:26 EDT; 1 months 1 days ago
BASH

서비스 구동

서비스를 구동하려면 start 명령어 뒤에 구동할 서비스 명을 입력합니다.

systemctl start mariadb
BASH


서비스 자동 시작

시스템 부팅시 자동으로 시작하려면 enable 명령을 주면 됩니다

systemctl enable mariadb
BASH


서비스 목록 보기

list-units 명령어를 사용해서 전체 서비스 목록을 확인할 수 있습니다.

$ sudo systemctl list-units
CODE


설치된 모든 unit 파일을 보려면 list-unit-files  사용하면 됩니다.

$ sudo systemctl list-unit-files
CODE


구동에 실패한 서비스 보기

$ sudo systemctl list-units --state=failed
CODE

enabled 된 모든 서비스 목록

$ sudo systemctl list-units --state=enabled
CODE



같이 보기