On Friday 15 Jul 2016 08:44:39 Rich Freeman wrote:
> On Fri, Jul 15, 2016 at 7:43 AM, Hogren <[email protected]> wrote:
> > After several strange problems, I discovered that my /tmp content was
> > never
> > deleted.
> > 
> > Is there a natif mechanism (with fstab or other option) and it's just a
> > misconfiguration or there isn't, and I need to use a systemd service ?
> 
> If you're using systemd this should all be default behavior, unless
> overridden.
> 
> tmpfs ought to be created as a tmpfs due to
> /usr/lib/systemd/system/tmp.mount unless you tell it to do something
> else in fstab or your own tmp.mount, or you somehow disable it.
> 
> That alone should clear it on every reboot.
> 
> I checked and it looks like the default on Gentoo is to not clear
> tmpfiles on a running system at all:
> cat /usr/lib/tmpfiles.d/tmp.conf
> v /tmp 1777 root root
> v /var/tmp 1777 root root
> 
> If you create /etc/tmpfiles.d/mytmp.conf and put those lines with a
> "10d" afterwards then it should purge files older than 10 days
> automatically.  I think.  I don't know exactly how tmpfiles.d
> overrides work.  You might have to copy the entire file to
> /etc/tmpfiles.d/tmp.conf and then edit those two lines in place.  Be
> sure to keep the exclusions, you don't want to kill tmpfiles for
> running daemons.
> 
> Or you can of course use something like tmpreaper.  I still have that
> running from my openrc days, and it of course works fine with systemd.

If you are using openrc go to /etc/conf.d/bootmisc and set:

 clean_tmp_dirs="/tmp"
 wipe_tmp="YES"

-- 
Regards,
Mick

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to