<systemctl로 서비스 예제>
$ systemctl is-enabled httpd.service
disabled
$ systemctl is-active httpd.service
unknown
$ systemctl is-active crond.service
inactive
$ systemctl is-enabled crond.service
enabled
서비스 설정 파일 확인하기
$ ls -al /usr/lib/systemd/system/httpd.service
-rw-r--r-- 1 root root 752 11월 20 06:35 /usr/lib/systemd/system/httpd.service
ls -al /usr/lib/systemd/system/crond.service
-rw-r--r--. 1 root root 284 7월 31 2014 /usr/lib/systemd/system/crond.service
<systemctl 커맨드 맛보기>
서비스 타입중 현재 실행중인 시스템 서비스 목록 보기
$ systemctl -t service -a --state running
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active running Arbitrary Executable File Formats File System Automount Point
session-30.scope loaded active running Session 30 of user deploy
acpid.service loaded active running ACPI Event Daemon
auditd.service loaded active running Security Auditing Service
dbus.service loaded active running D-Bus System Message Bus
getty@tty1.service loaded active running Getty on tty1
irqbalance.service loaded active running irqbalance daemon
network.service loaded active running LSB: Bring up/down networking
ntpd.service loaded active running Network Time Service
rsyncd.service loaded active running fast remote file copy program daemon
rsyslog.service loaded active running System Logging Service
snmpd.service loaded active running Simple Network Management Protocol (SNMP) Daemon.
sshd.service loaded active running OpenSSH server daemon
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-udevd.service loaded active running udev Kernel Device Manager
dbus.socket loaded active running D-Bus System Message Bus Socket
systemd-journald.socket loaded active running Journal Socket
systemd-udevd-control.socket loaded active running udev Control Socket
systemd-udevd-kernel.socket loaded active running udev Kernel Socket
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.
20 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
시스템의 모든 서비스의 간단한 모든 상태 정보를 보고 싶다면, 다음을 사용한다.
$ systemctl --type service --all
UNIT LOAD ACTIVE SUB DESCRIPTION
acpid.service loaded active running ACPI Event Daemon
auditd.service loaded active running Security Auditing Service
brandbot.service loaded inactive dead Flexible Branding Service
cloud-config.service loaded active exited Apply the settings specified in cloud-config
cloud-final.service loaded active exited Execute cloud user/final scripts
cloud-init-local.service loaded active exited Initial cloud-init job (pre-networking)
cloud-init.service loaded active exited Initial cloud-init job (metadata service crawler)
crond.service loaded inactive dead Command Scheduler
dbus.service loaded active running D-Bus System Message Bus
display-manager.service not-found inactive dead display-manager.service
dracut-shutdown.service loaded inactive dead Restore /run/initramfs
emergency.service loaded inactive dead Emergency Shell
exim.service not-found inactive dead exim.service
getty@tty1.service loaded active running Getty on tty1
ip6tables.service not-found inactive dead ip6tables.service
iptables.service not-found inactive dead iptables.service
유닛 파일 타입의 systemctl로 사용할 수 있는 시스템 서비스 목록을 본다.
$ systemctl list-unit-files
UNIT FILE STATE
proc-sys-fs-binfmt_misc.automount static
dev-hugepages.mount static
dev-mqueue.mount static
proc-sys-fs-binfmt_misc.mount static
sys-fs-fuse-connections.mount static
sys-kernel-config.mount static
sys-kernel-debug.mount static
tmp.mount disabled
brandbot.path disabled
systemd-ask-password-console.path static
systemd-ask-password-plymouth.path static
systemd-ask-password-wall.path static
session-2.scope static
session-29.scope static
session-30.scope static
session-9.scope static
acpid.service enabled
arp-ethers.service disabled
atd.service disabled
auditd.service enabled
autovt@.service disabled
brandbot.service static
cloud-config.service enabled
cloud-final.service enabled
cloud-init-local.service enabled
cloud-init.service enabled
...
리스닝하는 소켓 타입의 systemctl로 사용할 수 있는 시스템 서비스 목록을 본다.
$ systemctl list-sockets
LISTEN UNIT ACTIVATES
/dev/initctl systemd-initctl.socket systemd-initctl.service
/dev/log systemd-journald.socket systemd-journald.service
/run/systemd/journal/socket systemd-journald.socket systemd-journald.service
/run/systemd/journal/stdout systemd-journald.socket systemd-journald.service
/run/systemd/shutdownd systemd-shutdownd.socket systemd-shutdownd.service
/run/udev/control systemd-udevd-control.socket systemd-udevd.service
/var/run/dbus/system_bus_socket dbus.socket dbus.service
kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
8 sockets listed.
Pass --all to see loaded but inactive sockets, too.
사용할 수 있는 모든 유닛 타입은 다음과 같다.
$ systemctl -t help
Available unit types:
service
socket
target
device
mount
automount
snapshot
timer
swap
path
slice
scope
특정 서비스의 dependency 유닛을 보려면 다음과 같은 커맨드를 사용한다.
$ systemctl list-dependencies crond.service
crond.service
├─system.slice
└─basic.target
├─microcode.service
├─rhel-autorelabel-mark.service
├─rhel-autorelabel.service
├─rhel-configure.service
├─rhel-dmesg.service
├─rhel-loadmodules.service
├─paths.target
├─slices.target
│ ├─-.slice
│ └─system.slice
├─sockets.target
│ ├─dbus.socket
│ ├─rsyncd.socket
│ ├─systemd-initctl.socket
│ ├─systemd-journald.socket
│ ├─systemd-shutdownd.socket
│ ├─systemd-udevd-control.socket
│ └─systemd-udevd-kernel.socket
├─sysinit.target
│ ├─dev-hugepages.mount
│ ├─dev-mqueue.mount
│ ├─kmod-static-nodes.service
│ ├─plymouth-read-write.service
│ ├─plymouth-start.service
│ ├─proc-sys-fs-binfmt_misc.automount
│ ├─sys-fs-fuse-connections.mount
│ ├─sys-kernel-config.mount
│ ├─sys-kernel-debug.mount
│ ├─systemd-ask-password-console.path
│ ├─systemd-binfmt.service
│ ├─systemd-journal-flush.service
│ ├─systemd-journald.service
│ ├─systemd-modules-load.service
│ ├─systemd-random-seed.service
│ ├─systemd-sysctl.service
│ ├─systemd-tmpfiles-setup-dev.service
│ ├─systemd-tmpfiles-setup.service
│ ├─systemd-udev-trigger.service
│ ├─systemd-udevd.service
│ ├─systemd-update-utmp.service
│ ├─systemd-vconsole-setup.service
│ ├─cryptsetup.target
│ ├─local-fs.target
│ │ ├─-.mount
│ │ ├─rhel-import-state.service
│ │ ├─rhel-readonly.service
│ │ ├─systemd-fsck-root.service
│ │ └─systemd-remount-fs.service
│ └─swap.target
│ └─swap-swapfile1.swap
└─timers.target
└─systemd-tmpfiles-clean.timer
'unix and linux' 카테고리의 다른 글
[python] carriage return 이슈 (0) | 2016.05.27 |
---|---|
dstat 툴 (0) | 2016.05.23 |
[centos 7] realpath 명령어 (0) | 2016.05.03 |
센트OS 7 다운로드 URL 설명 (0) | 2016.05.02 |
setuid 동작 결과를 ps로 확인하기(ruser, euser) (0) | 2016.04.28 |