Table of Contents |
---|
...
출처: https://en.wikipedia.org/wiki/Systemd#/media/File:Systemd_components.svg
Target 관리
Info |
---|
|
기본 타겟 확인
Code Block | ||
---|---|---|
| ||
$ systemctl get-default
multi-user.target |
타겟 목록 출력
Code Block | ||
---|---|---|
| ||
$ systemctl list-units --type target
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
cryptsetup.target loaded active active Encrypted Volumes
getty.target loaded active active Login Prompts
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
network.target loaded active active Network
paths.target loaded active active Paths
remote-fs.target loaded active active Remote File Systems
slices.target loaded active active Slices
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
timers.target loaded active active Timers
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type |
활성화되지 않은 타겟(rescue, emergency 등) 목록도 출력하려면 --all 옵션 추가
Code Block | ||
---|---|---|
| ||
$ systemctl list-units --type target --all |
기본 타겟 변경
Code Block | ||
---|---|---|
| ||
$ systemctl set-default name.target |
설치시 기본 타겟은 multi-user.target 이며 부팅시 X-Windows 로 로그인하려면 graphical.target 으로 설정
Code Block | ||
---|---|---|
| ||
$ sudo systemctl set-default graphical.target |
재부팅하지 않고 현재 타겟 변경
재부팅하지 않고 현재 리눅스의 런 레벨(run level)을 변경하는 명령어인 telinit 처럼 systemctl isolate 명령어를 사용하면 현재 target 을 변경할 수 있음.
Code Block | ||||
---|---|---|---|---|
| ||||
$ sudo systemctl isolate graphical.target |
Code Block | ||||
---|---|---|---|---|
| ||||
$ sudo systemctl isolate multi-user.target |
single user mode
시스템 복구등의 이유로 single user mode 로 진입할 필요가 있을 경우 rescue 명령어 사용
Code Block | ||
---|---|---|
| ||
$ sudo systemctl rescue |
systemctl emergency
파일 시스템이 깨졌거나 등의 이유로 single mode 로 진입할 수 없을 때 emergency 로 들어가면 부팅시 최소의 기능으로만 부팅(root 파일 시스템은 read only 로 마운트하고 다른 파일 시스템은 마운트를 안 하는 등) 하므로 응급 복구 가능
Code Block | ||
---|---|---|
| ||
$ sudo systemctl emergency |
기존 명령어와 비교
service
...
title | service 명령어와 systemctl 비교 |
---|
...
service name start
...
systemctl start name.service
...
service name stop
...
systemctl stop name.service
...
service name restart
...
systemctl restart name.service
...
service name condrestart
...
systemctl try-restart name.service
...
service name reload
...
systemctl reload name.service
...
service name status
...
systemctl status name.service
systemctl is-active name.service
...
service --status-all
...
systemctl list-units --type service --all
...
chkconfig
...
title | chkconfig 명령어와 systemctl 비교 |
---|
...
chkconfig name on
...
systemctl enable name.service
...
chkconfig name off
...
systemctl disable name.service
...
chkconfig --list name
...
systemctl status name.service
systemctl is-enabled name.service
...
chkconfig --list
...
systemctl list-unit-files --type service
...
chkconfig --list
...
systemctl list-dependencies --after
...
chkconfig --list
...
systemctl list-dependencies --before
...
linux systemctl 명령으로 부팅 타겟(booting target) 지정하기 참고
service/chckconfig 명령어와 비교
systemctl 과 service/chckconfig 명령어 비교표 참고
서비스 관리
서비스 상태 확인
status 명령어 뒤에 확인할 서비스 명을 주고 실행하면 됩니다.
...
Linux journalctl 사용법 을 참고하세요.