cook:systemd

cook:systemd

启动过程性能分析 #

systemd-analyze time
找出引导过程中花费时间最多的服务
systemd-analyze blame
systemd-analyze verify
systemd-analyze critical-chain

systemd-analyze plot > boot.svg 将引导过程写入SVG格式的文件 systemd-analyze dot graphical.target | dot -Tsvg > graphical.svg

资源使用情况 #

systemd-cgls 以递归形式展示cgroup的结构层次 systemd-cgtop 显示单元的资源使用情况

日志持久化存储 #

systemd-journald默认将日志记录到tmpfs文件系统的/run/log/journal/目录下。若要持久化,需做如下操作:

mkdir -p -m 2775 /var/log/journal
chgrp systemd-journal /var/log/journal
systemctl restart systemd-journald

systemctl #

systemctl list-unit-files -t service
systemctl [list-units] -t service
systemctl [list-units] -at service
systemctl [list-units] --type service --all
systemctl [list-units] --type service --failed
systemctl [list-units] -t service --state=dead
systemctl enable --now httpd
systemctl edit --force --full timestamp.service
systemctl list-dependencies graphical.target
systemctl list-dependencies --after network.target
systemctl get-default
systemctl set-default multi-user
sudo systemctl isolate multi-user

cook:journalctl