30.07.2025 11:00, Marc Haber wrote:
Hi,

On Wed, Jul 30, 2025 at 07:31:56AM +0300, Andrei Borzenkov wrote:
29.07.2025 11:30, Marc Haber wrote:
Hi,

I have a template service unit which runs a oneshot service that
generates both high CPU and high I/O load for a couple of minutes. The
service is templated a couple of times and runs from an, also templated
timer.

In another use case, I have independent services that generate high CPU
and high I/O.


It is unclear what you want

I apologize for not making myself clear. Let me try doing this with
"traditional" things.

I have a unknown number of processes that would be one-shot services in
systemd lingo. Some of them are equal but differently parametrized,
others are completely different. I want only one of the to run at at
time, and if another one wants to start while one is still running, I
want the new one to wait.

This will require that every service lists all other services in its After/Before list and that the they are ordered linearly. The actual order does not matter.

Depending on the exact environment it may be easier than using explicit locking.

In the classic way all those services would know the path to a shared
lock and run with flock(1) --exclusive with a very high value for
--timeout. This is probably what I'll do with my systemd 257 system.


Note that using After and locking will trigger different timeouts (JobTimeoutSec and TimeoutStartSec).

I think that the new systemd 258 slice semantics might help, but I won't
have that for a few years. So I'll probably use the flock thing in
ExecStart.

  From what I understand, in Before=/After= you need to know what the
processes are and you need to define an order in which they'll run.

Not processes but systemd units. Please use the correct terms to avoid making it even more confusing.

That's not what I want. But I might have misunderstood that and would
appreciate an example of what the suggestion is.

I find the entire Before/After and Wants/Requires incredibly powerful
but also hard to grasp. I am not a newbie to systemd but this is
something that I have not fully understood yet.

Greetings
Marc


Reply via email to