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

+1 -1
View File
@@ -28,7 +28,7 @@ Features
* [Conditions](conditions.md) for network/process/custom dependencies
* [Readiness notification](config/service-sync.md); PID files (native) for synchronizing system
startup, support for systemd [sd_notify()][], or [s6 style][] too
* Limited support for [tmpfiles.d(5)][] (no aging, attributes, or subvolumes)
* Limited support for [tmpfiles.d(5)][] (no attributes, subvolumes, or specifiers)
* [Pre/Post script actions](config/service-wrappers.md)
* Rudimentary [templating support](config/templating.md)
* [Tooling](initctl.md) to enable/disable services
+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
+6 -13
View File
@@ -8,22 +8,17 @@ files or common packages already rely on, last what few will miss.
[tmpfiles.d(5)]: https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
1. Nothing runs the clean pass
------------------------------
1. Ages
-------
Finit calls `tmpfiles --create --remove --boot` at boot and nothing
else. The age field has no effect until the user adds a task for
`tmpfiles --clean`.
Finit never runs `tmpfiles --clean` itself, `doc/plugins.md` tells the
user to call it from cron.
* Ship a task for it, systemd runs its timer 15 min after boot and
then daily
* `x` and `X` are accepted but exclude nothing from cleaning
* Age `0` should clean everything, it is read as no age
* Cleaning crosses mount points, it should stay on one file system
* Only one number with `s`, `m`, `h`, `d`, or `w` is read. Missing
are `1d12h`, `ms`, `us`, the `~` prefix, and the `a`, `b`, `c`, `m`
selectors for which timestamps to compare
* The age is only used for `d`, `D`, and `e`
* The age is only used for `d`, `D`, and `e`, and an `e` entry with a
glob in the path is not cleaned
2. Prefixes that are silently dropped
@@ -101,8 +96,6 @@ their own paths.
* Files are processed one directory at a time. tmpfiles.d(5) sorts
all of them by name, whatever directory they are in, so `00-x.conf`
in `/etc` should run before `50-y.conf` in `/usr/lib`
* `doc/README.md`, `doc/index.md`, and `doc/plugins.md` say there is
no aging. There is, see 1 above
* `a` and `A` handle an ACL of at most 32 entries, a path with more is
left as it is, with a warning
* `mksubsys()` in `src/util.c` is unused
+1 -1
View File
@@ -94,7 +94,7 @@ and s6 notification is also supported.
.It
Limited support for
.Xr tmpfiles.d 5 ,
no aging, attributes, or subvolumes
no attributes, subvolumes, or specifiers
.It
Pre/Post script actions
.It