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