Linux? , , . Linux . , . , .

/tmp
, , (volatile) /run
.
, . , .
Linux
Red Hat Enterprise Linux 7 systemd-tmpfiles
. .
:
$ systemctl status systemd-tmpfiles-* ? systemd-tmpfiles-setup.service - Create Volatile Files and Directories Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup.service; static; vendor preset: disabled) Active: active (exited) since Mon 2020-02-10 08:27:50 EAT; 1 weeks 3 days ago Docs: man:tmpfiles.d(5) man:systemd-tmpfiles(8) Process: 794 ExecStart=/usr/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=0/SUCCESS) Main PID: 794 (code=exited, status=0/SUCCESS) CGroup: /system.slice/systemd-tmpfiles-setup.service Feb 10 08:27:50 envoy-nginx.novalocal systemd[1]: Starting Create Volatile Files and Directories... Feb 10 08:27:50 envoy-nginx.novalocal systemd[1]: Started Create Volatile Files and Directories. ? systemd-tmpfiles-setup-dev.service - Create Static Device Nodes in /dev Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup-dev.service; static; vendor preset: disabled) Active: active (exited) since Mon 2020-02-10 08:27:49 EAT; 1 weeks 3 days ago Docs: man:tmpfiles.d(5) man:systemd-tmpfiles(8) Process: 553 ExecStart=/usr/bin/systemd-tmpfiles --prefix=/dev --create --boot (code=exited, status=0/SUCCESS) Main PID: 553 (code=exited, status=0/SUCCESS) CGroup: /system.slice/systemd-tmpfiles-setup-dev.service Feb 10 08:27:49 envoy-nginx.novalocal systemd[1]: Starting Create Static Device Nodes in /dev... Feb 10 08:27:49 envoy-nginx.novalocal systemd[1]: Started Create Static Device Nodes in /dev.
systemd-tmpfiles-setup
systemd-tmpfiles create remove
. :
/usr/lib/tmpfiles.d/.conf
/run/tmpfiles.d/.conf
/etc/tmpfiles.d/*.conf
, , . , , .
Systemd
systemd
, systemd-tmpfiles-clean.timer
, systemd-tmpfiles-clean.service
, systemd-tmpfiles clean
.
[Timer]
, .
$ cat /usr/lib/systemd/system/systemd-tmpfiles-clean.timer # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. [Unit] Description=Daily Cleanup of Temporary Directories Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8) [Timer] OnBootSec=15min OnUnitActiveSec=1d
systemd-tmpfiles-clean.service
15 . 24 . .
, , .
sudo systemctl daemon-reload sudo systemctl enable --now systemd-tmpfiles-clean.timer
systemd-tmpfiles
/mytmp
. , , 3 .
- /usr/lib/tmpfiles.d/tmp.conf
, .
$ sudo vim /etc/tmpfiles.d/mytmp.conf See tmpfiles.d(5) for details # Clear tmp directories separately, to make them easier to override q /mytmp 1777 root root 3d
, , , .
d /run/mytmp 0700 root root 60s
, 60 , .
, , .
sudo systemd-tmpfiles --create /etc/tmpfiles.d/mytmp.conf
, , . :
systemd-tmpfiles --clean /etc/tmpfiles.d/mytmp.conf