Senior LevelLinux Commands & SysAdmin
How does systemd-tmpfiles manage automated volatile temporary file purging?
❓ Interview Prompt: Explain systemd-tmpfiles service, configuration directories (/etc/tmpfiles.d/*.conf), file creation/deletion rules (d, f, e, x, q), and age-based purging.
'systemd-tmpfiles' manages volatile temporary directories, sockets, and files, automatically purging stale temporary items based on age or path rules:
Configuration Rules ('/etc/tmpfiles.d/myapp.conf'):
•
'd /var/run/myapp 0755 deploy deploy 10d': Creates directory owned by deploy, purging files older than 10 days.
•
Executed via 'systemd-tmpfiles --clean'.
Code Implementation Example
ini
# /etc/tmpfiles.d/app-cleanup.conf
# Type Path Mode User Group Age
d /var/tmp/app-cache 0755 deploy deploy 7d
e /tmp/sessions 0700 root root 1d💡systemd-tmpfiles configuration purging temporary cache files older than 7 days.
🎯 Interview Key Takeaway
Use systemd-tmpfiles configuration rules in /etc/tmpfiles.d/ to automate volatile directory cleanup and temporary file purging.
#systemd-tmpfiles#Temp Files#Cleanup#Senior
Back to all Linux Commands & SysAdmin Questions→