Am 03.04.21 um 23:28 schrieb DennisG:
On 4/3/21 12:02 PM, Peter McD wrote:
Am 03.04.21 um 16:44 schrieb Till Dörges:
Am 03.04.21 um 13:39 schrieb Peter McD:
Anyway I change q /var/tmp 1777 root root 1d two reboots and /var/tmp still gets cleared?
Yes, that's what I'd expect. But beware that you have to edit the correct configuration file. After the change in the filesystem RPM it should be /etc/tmpfiles.d/fs-var-tmp.conf (rather than /etc/tmpfiles.d/tmp.conf) So I move from /usr/lib/tmpfiles.d/fs-var-tmp.conf to /etc/tmpfiles.s/
and modify # d /var/tmp 1777 root root - to d /var/tmp 1777 root root 1d
I expect after a reboot older folders/files. e.g. drwx------ 3 root root 4096 3. Apr 17:40 systemd-private-6704694542b3421f8612991315fd7962-chronyd.service-RNsuvq But several reboots later there are only the folders/files with the same /date/time of the latest boot time. e.g. drwx------ 3 root root 4096 3. Apr 17:56 systemd-private-6d19ab9a0f284936a9177444417f38b8-chronyd.service-33ZqOB What is wrong?
I'm not sure I understand your question. Perhaps this may help . . .
I assumed that setting "d /var/tmp 1777 root root 1d" will clean at the earliest 24h after creation whatever is in "/var/tmp" unless it has been accessed by any system activity. A new test. I copied a dummy.txt to /var/tmp, rebooted and bingo it is still there, I expect it to be deleted after 1 day. I could have set, as you did to 1h, but I think "d" works as intended.
"The age of a file system entry is determined from its last modification time (mtime), its last access timestamp (atime), and (except for directories) its last status change timestamp (ctime). Any of these three (or two) values will prevent cleanup if it is more recent than the current time minus the age field." ... Your "1d" age parameter should work fine. Just note however that there are programs which will put a file under /tmp that it will use as long as it is open but will not be protected from deletion, this can happen with X. Consequently, deleting that file can crash or lock that program. ...
Of course if you boot daily that avoids such problems. An alternative that guarantees the cleaning will only happen at boot, despite whenever systemd-tmpfiles may be run, is to place a "!" after the "d" command (i.e., "d!") and change the systemd-tmpfiles-clean.service file to add the "--boot" flag. This way systemd-tmpfiles will always ignore the cleaning command except at boot.
Ok, I thinl to be safe it is better to use "d!" on my computer. Thanks Peter