doc: how to run tmpfiles --clean, from cron

Finit only runs tmpfiles at boot, to create and remove.  The age of an
entry has no effect until something calls tmpfiles --clean, and the
documentation said there was no aging at all.

Describe how to call it from cron, with a service as the fallback on a
system without cron, and what cleaning leaves alone.  Update the
tmpfiles TODO to match.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-11-20 18:02:36 +01:00
1 parent bc2f2ba4bb
commit f5e7946489
4 files changed
+36 -18

No files matched your search

+28 -3
View File
@@ -23,14 +23,39 @@ For your convenience a set of *optional* plugins are available:
file systems must be writable for this plugin to work.
This plugin is a wrapper for the [tmpfiles.d(5)][] implementation that
Finit has. Capable but limited: no aging, attributes, or subvolumes.
It runs `tmpfiles --create --remove --boot`, so entries marked
boot-only with a `!` are run here and at no other time.
Finit has. Capable but limited: no attributes, subvolumes, or
specifiers. It runs `tmpfiles --create --remove --boot`, so entries
marked boot-only with a `!` are run here and at no other time.
By default, `/lib/finit/tmpfiles.d` carries all the default .conf
files distributed with Finit. It is read first but can be overridden
by any of the standard tmpfiles.d directories, e.g. `/etc/tmpfiles.d`.
The age of an entry, e.g. `10d` below, is used only by `tmpfiles
--clean`, which Finit never runs on its own:
d /var/tmp 1777 root root 10d
To have what is older than that removed, call it from cron, here
once a day from a system crontab. The program is installed in
`$libexecdir/finit/`, e.g. `/libexec/finit/`:
0 4 * * * root /libexec/finit/tmpfiles --clean
On a system without cron a service can do the same. It counts from
when it was started, so the time of day drifts with each boot:
service tmpfiles-clean {
description = "Periodic tmpfiles cleanup"
runlevel = "2345"
command = "sh -c 'while sleep 86400; do /libexec/finit/tmpfiles --clean; done'"
}
Cleaning stays on the file system of the directory, and it leaves
what `x` and `X` entries name. A file is kept as long as one of its
access, change, and modification times is newer than the age. With
the age `0` everything in the directory is removed.
> [!NOTE]
> On an embedded system both `/var` and `/run` can be `tmpfs` RAM
> disks and `/dev` is usually a `devtmpfs`. This must be defined in