- goal - to standardize the aspect of system administration
- program + daemon + library + tech + kernel config
- dependent only on Linux kernel
- unit: entity managed by systemd
- cf. systemd.unit man page: https://www.freedesktop.org/software/systemd/man/systemd.unit.html
- the action of each unit defined in systemd and is configured by a unit file.
- ex. service
- unit file specifies the location of daemon execution file, informs systemd about how to start and stop the service, and also specifies other unit which the service is dependent on.
- ex. service
- unit file can be located in multiple locations.
- mainly in
/usr/lib/systemd/system
when installing the package. - some systems use
/lib/systemd/system
as the path. -> this is the original so do not edit. - put local unit file or edited version in
/etc/systemd/system
/run/systemd/system
has unit directory and workspace for saving temporary unit.- systemd manages looking into all the directories above so there are almost same. -> if there's the difference then
/etc/systemd/system
gets the highest priority. - suffix of unit file by unit type
- .service
- .timer
[Unit] # the section for all unit types
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf
[Service] # the section only in "service" unit type
ExecStart=/usr/bin/rsync --daemon --no-detach
[Install]
WantedBy=multi-user.target
- systemctl: versatile command to assess the status of systemd or change the configuration
systemctl subcommand option
- typically use unit name except unit type suffix(ex. cups instead of cups.service) when using subcommand for specific unit
- but the default unit type that gives specificity to a simple name varies depending on the subcommands
- if, there are
one.service
andone.socket
and the default unit type ofstop
is socket ->systemctl stop one
stopsone.socket
- if, there are
systemctl
==systemctl list-units
subcommand | function |
---|---|
list-units [pattern] | every loaded or activated service, socket, target, mount, device at present, can choose unit type; ex. using --type=service ([pattern]) |
list-unit-files [pattern] | installed unit file at present regardless activation status |
enable unit | activate unit during booting |
disable unit | stop activating unit during booting |
isolate target | change operating mode to target |
start unit | activate unit immediately |
stop unit | deactivate unit immediately |
restart unit | restart unit (or just start if it is deactivated) immediately |
status unit | show status of unit and recent log items |
kill pattern | send a signal to the unit that matches the pattern |
reboot | reboot the computer |
daemon-reload | reload unit fule and systemd configuration |
systemctl status -l unit
root@server ~ # systemctl status -l nvmefc-boot-connections
● nvmefc-boot-connections.service - Auto-connect to subsystems on FC-NVME devices found during boot
Loaded: loaded (/lib/systemd/system/nvmefc-boot-connections.service; disabled; vendor preset: enabled)
Active: inactive (dead)
.
.
.
- it shows if it is activated, inactive time(if it is dead), and whether it was activated during server boot(
Loaded
part) - last four sentences are the recent logs
- logs are compressed by one line by default -> with
-l
it shows all the logs
- logs are compressed by one line by default -> with
status | meaning |
---|---|
bad | systemd internal issue, usually unit file error |
disabled | installed, but not start automatically |
enabled | installed, and start automatically |
indirect | inactive but there is a peer which can be activated in Also section |
linked | unit which can be used by symbolic link(symlink) |
masked | unit which is expelled logically |
static | dependent unit by other unit, no installation requirements |
enabled
anddisabled
status are located in one of thesystem directories of systemd
(not linked by symbolic link), and applied only which has[Install]
section in unit file- enabled unit is almost installed unit
The unit is installed.
means that the command in[Install]
section is already executed and ready to be activated properly- usually
enabled
status activate the unit automatically after the system bootstrap
- there are many units without install process
- these units cannot be enabled or disabled but only be available ->
static
- these units cannot be enabled or disabled but only be available ->
static
status unit file only can be activated bysystemctl start
or by dependency of other activated units
masked
status means blocked for administrative purposes- systemd is aware of masked status unit but blocks it from the activation or the influence to the environment command by
systemctl mask
systemctl disable
for activated or linked unitsystemctl mask
for static unit- for disabled, inactive unit
systemctl enable
systemctl start
Q. indirect, linked, masked?
Q. symbolic link로 연결 무슨 의미?
Q. - usually
enabled
status activate the unit automatically after the system bootstrap -> system bootstrap==서버가 켜지면?Q. 마찬가지로 비활성화됐다는 것은 일반적인 활성 경로에 있다는 것이기 때문에 disabled 상태라는 것은 다소 부적절하다. / 활성화된(enabled) 유닛은 사실상 설치된(installed) 유닛으로 간주돼야 한다. -> deactivated does not mean
disabled
status since it is on a typical active route? -> disabled라는 표현이 부적절하다는걸까? 언제든 실행될 수 있기 때문에?Q. linked는 설명을 듣고 다시 정리하자....