> On 29 Jul 2025, at 09:30, Marc Haber <mh+systemd-de...@zugschlus.de> 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.
> 
> In both cases, it has been measured that total processing time is quicker 
> when one lets the jobs run one after the other instead of having them 
> conurrently compete over same set of resources. The measurement results are 
> even more clear when the data is stored on HDDs due to head movement and disk 
> rotation latency.
> 
> I would like to lock them against each other that only one of those services 
> runs concurrently at a time, and other instances that might have been 
> requested while one is still running are delayed until everyhing is "free". 
> Missing a job because one other is already running would be a bug.
> 
> The solution one finds on the net is to use flock(1) in the ExecStart* 
> options, often making wrapper scripts necessary. I find this clumsy and 
> un-systemd-like and would not like to do that.
> 
> Does systemd offer a better solution for this?

Is it possible to use After= or Before= in template services to order them?

That is what you would do for non-template services normally.

Barry


> 
> Greetings
> Marc
> 
> -- 
> -----------------------------------------------------------------------------
> Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
> Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
> Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421
> 

Reply via email to