1 |
On Fri, Jul 15, 2016 at 7:43 AM, Hogren <hogren@×××××.com> wrote: |
2 |
> |
3 |
> After several strange problems, I discovered that my /tmp content was never |
4 |
> deleted. |
5 |
> |
6 |
> Is there a natif mechanism (with fstab or other option) and it's just a |
7 |
> misconfiguration or there isn't, and I need to use a systemd service ? |
8 |
> |
9 |
|
10 |
If you're using systemd this should all be default behavior, unless overridden. |
11 |
|
12 |
tmpfs ought to be created as a tmpfs due to |
13 |
/usr/lib/systemd/system/tmp.mount unless you tell it to do something |
14 |
else in fstab or your own tmp.mount, or you somehow disable it. |
15 |
|
16 |
That alone should clear it on every reboot. |
17 |
|
18 |
I checked and it looks like the default on Gentoo is to not clear |
19 |
tmpfiles on a running system at all: |
20 |
cat /usr/lib/tmpfiles.d/tmp.conf |
21 |
v /tmp 1777 root root |
22 |
v /var/tmp 1777 root root |
23 |
|
24 |
If you create /etc/tmpfiles.d/mytmp.conf and put those lines with a |
25 |
"10d" afterwards then it should purge files older than 10 days |
26 |
automatically. I think. I don't know exactly how tmpfiles.d |
27 |
overrides work. You might have to copy the entire file to |
28 |
/etc/tmpfiles.d/tmp.conf and then edit those two lines in place. Be |
29 |
sure to keep the exclusions, you don't want to kill tmpfiles for |
30 |
running daemons. |
31 |
|
32 |
Or you can of course use something like tmpreaper. I still have that |
33 |
running from my openrc days, and it of course works fine with systemd. |
34 |
|
35 |
-- |
36 |
Rich |