On Fri, Oct 1, 2021 at 5:24 PM antlists <antli...@youngman.org.uk> wrote:
[...]

> Ouch. Dunno if that would work. Bear in mind I'm running this BEFORE
> fstab, so / is read-only ...
>

You can store the timestamp in /run and then have another unit that updates
the timestamp in /var after remounting root (/) read/write. Again, you have
all the flexibility of scripts+systemd units.

I will have to see if the timer can set up the oneshot service, and if
> it really is one shot per activation ...
>

It's one shot per activation, but the activation is set either by timer, or
by unit dependency (After= and/or Before=), AFAIU. I don't think the
granularity you want is there: the timer will elapse once a week, whether
you are booting or running the system (if using timers); or it will run at
boot, whether a week has passed or not (if using a normal service). I don't
think you can mix and match; the precise state you want is beyond what
systemd offers (I think).

I think the simpler answer is to write a script and handle the state
yourself; but knock yourself up. It's possible I'm wrong and you can do
that with only systemd units/timers.

Regards.
[1] https://man7.org/linux/man-pages/man5/systemd.timer.5.html
-- 
Dr. Canek Peláez Valdés
Profesor de Carrera Asociado C
Departamento de Matemáticas
Facultad de Ciencias
Universidad Nacional Autónoma de México

Reply via email to