Systemd:/usr/lib/ 中配置文件背后的逻辑

Systemd:/usr/lib/ 中配置文件背后的逻辑

我正在寻找用于清除CentOS 7 默认安装上的/tmp和目录的配置。经过一番搜索,我发现了包含实际保留期的/var/tmp文件。/usr/lib/tmpfiles.d/tmp.conf

我有兴趣了解该文件放置背后的逻辑。鉴于没有名为“tmpfiles”的单元,我如何在不随机谷歌搜索的情况下推断出该位置?

答案1

鉴于没有名为“tmpfiles”的单元,我如何在不随机谷歌搜索的情况下推断出该位置?

% apropos tmp -l
systemd-gpt-auto-generator (8) - Generator for automatically discovering and mounting root, /home/, /srv/, /var/ and /var/tmp/ partitions, as well as discovering and enabling swap partitions, based on GPT partition type GUIDs.
systemd-tmpfiles (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-clean.service (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-clean.timer (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-setup-dev.service (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-setup.service (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-update-utmp (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp-runlevel.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
tmpfiles.d (5)       - Configuration for creation, deletion and cleaning of volatile and temporary files
utmpdump (1)         - dump UTMP and WTMP files in raw format

忽略utmp条目,man 8 systemd-tmpfiles与其他联机帮助页相同systemd-tmpfiles-*,它指的是man 5 tmpfiles.d, 其中有:

/etc/tmpfiles.d/*.conf
/run/tmpfiles.d/*.conf
/usr/lib/tmpfiles.d/*.conf


~/.config/user-tmpfiles.d/*.conf
$XDG_RUNTIME_DIR/user-tmpfiles.d/*.conf
~/.local/share/user-tmpfiles.d/*.conf
/usr/share/user-tmpfiles.d/*.conf

第一组用于系统配置,第二组用于用户配置。


至于逻辑,systemd 配置通常位于/usr/lib(或/lib,取决于发行版和/usr统一,但在发行版内一致),相应的覆盖目录位于/etc/run,因此没有什么特别令人惊讶的。

相关内容