[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to prevent /tmp files from being deleted at reboot



Thank you for looking into this.

Now to your issue. You said you wanted time based clean-up (remove files
older then 30 days) but *not* remove them on boot.

In fact, cleanup on boot would be fine. However, "cleanup" should only cleanup files older than the age argument.

I tried these:

- Empty /etc/tmpfiles.d/tmp.conf :

   As expected, nothing is cleaned up.

- "D /tmp/ 1777 root root 30d"

   Everything is deleted at boot, or when running "systemd-tmpfiles --create
   --remove --clean"
   Also with  "~30d" instead of "30d".

- "d /tmp/ 1777 root root 30d"

   Nothing is deleted at boot or when running "systemd-tmpfiles --create --remove
   --clean" without a reboot.

   # grep ' /tmp' /etc/tmpfiles.d/tmp.conf
   d /tmp 1777 root root 30d
   x /tmp/systemd-private-%b-*
   X /tmp/systemd-private-%b-*/tmp
   # reboot
   ...
   # ls -Al /tmp/
   total 36
   ...
   -rw-rw-r-- 1 root root    8 Jul 16 15:21 KEEPTHIS.txt
   -rw-rw-r-- 1 root root    9 Jan  1  2016 TOOOLD.txt
   ...

So the age argument seems to always be ignored?

And I find no way to get the old (before systemd) behaviour: cleanup /tmp at boot, but preserve "recent" files

If this is the expected behaviour, then either the documentation is quite unclear and misleading, or I'm too dumb to understand it (which is actually quite possible...)

MI


Reply to: