클라우드 네이티브 애플리케이션 부트캠프 알림

티스토리 뷰

systemctl

systemctl은 등록된 daemon service를 보는 명령입니다.
daemon service의 유형에는 service, socket, target, device 가 있습니다.

[root@bastion ~]# systemctl list-units --type=service
UNIT                                                         LOAD   ACTIVE SUB     DESCRIPTION
auditd.service                                               loaded active running Security Auditing Service
chronyd.service                                              loaded active running NTP client/server
cloud-config.service                                         loaded active exited  Apply the settings specified in cloud-config
...

[root@bastion ~]# systemctl list-units --type=socket
UNIT                         LOAD   ACTIVE SUB       DESCRIPTION
dbus.socket                  loaded active running   D-Bus System Message Bus Socket
systemd-initctl.socket       loaded active listening /dev/initctl Compatibility Named Pipe
systemd-journald.socket      loaded active running   Journal Socket
...

[root@bastion ~]# systemctl list-units --type=target
UNIT                  LOAD   ACTIVE SUB    DESCRIPTION
basic.target          loaded active active Basic System
cloud-config.target   loaded active active Cloud-config availability
cloud-init.target     loaded active active Cloud-init target
cryptsetup.target     loaded active active Local Encrypted Volumes
...

[root@bastion ~]# systemctl list-units --type=device
UNIT                                             LOAD   ACTIVE SUB     DESCRIPTION
sys-devices-platform-serial8250-tty-ttyS1.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1
sys-devices-platform-serial8250-tty-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2
sys-devices-platform-serial8250-tty-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3
...

systemd로 등록된 서비스들은 /usr/lib/systemd 디렉토리에 설치됩니다.

[root@bastion systemd]# cd /usr/lib/systemd
[root@bastion systemd]# ls -al | more
total 8096
...
drwxr-xr-x.  2 root root    4096 Jun  3 23:23 system-generators
drwxr-xr-x.  2 root root    4096 Jun  3 23:22 system-preset
drwxr-xr-x.  2 root root    4096 May 12 10:45 system-shutdown
drwxr-xr-x.  2 root root    4096 May 12 10:45 system-sleep
-rwxr-xr-x.  1 root root 1628560 May 12 10:45 systemd
-rwxr-xr-x.  1 root root   23968 May 12 10:45 systemd-ac-power
-rwxr-xr-x.  1 root root   70152 May 12 10:45 systemd-activate
-rwxr-xr-x.  1 root root   74776 May 12 10:45 systemd-backlight
-rwxr-xr-x.  1 root root   62192 May 12 10:45 systemd-binfmt
-rwxr-xr-x.  1 root root  128056 May 12 10:45 systemd-bootchart
-rwxr-xr-x.  1 root root   36768 May 12 10:45 systemd-cgroups-agent
-rwxr-xr-x.  1 root root  132976 May 12 10:45 systemd-coredump

systemctl로 daemon service 관리

  • 시작: systemctl start <service명>
  • 중지: systemctl stop <service명>
  • 상태: systemctl status <service명>

머신 부팅 시 시작 프로그램으로 등록/해제

  • 등록: systemctl enable <service명>
  • 해제: systemctl disable <service명>

상태 보기 명령어들

  • is-active
  • is-enabled

서비스 사용 허용 / 금지

  • mask : 서비스 사용 못하게 마킹함
  • unmask : mask를 제거하여 서비스를 사용하게 함
댓글

클라우드 네이티브 애플리케이션 부트캠프 알림