[systemd-devel] tmpfiles versus tmpwatch

Kai Krakow hurikhan77 at gmail.com
Tue Apr 28 23:43:01 PDT 2015


Roger Qiu <roger.qiu at polycademy.com> schrieb:

> I'm planning to use tmpwatch's `fuser` feature.
> 
> But I'd prefer to run this simple service using systemd's tmpfiles.
> Does systemd tmpfiles support running `fuser` so that way it won't
> delete any files that have an open file descriptor?
> 
> I couldn't see any mention of in the docs and source code
> (https://github.com/systemd/systemd/blob/master/src/tmpfiles/tmpfiles.c).

I don't think it will or ever will but I'm not a dev.

The point is: tmpwatch's fuser feature is IMHO just a countermeasure for 
filesystems mounted with noatime in combination with wrongly behaving 
software which has long living processes opening files in /tmp. That's wrong 
by design.

Such software should put such files in /var/tmp (which is, according to unix 
standards, volatile, too, but would survive reboots and files should stay 
around 30 days without usage) or in /var/{cache,spool,lib}. For /var/cache 
subdirectories you could setup tmpfiles or tmpwatch - whatever is more 
appropriate to you.

Files with very long open times and never being touched in a long time just 
don't belong into /tmp. And if you want to ensure that a file isn't 
accidently deleted too early, don't enable noatime. Use relatime (or maybe 
lazytime from the next kernel versions which is much more posix conform).

-- 
Replies to list only preferred.



More information about the systemd-devel mailing list