How do I start multiple systemd services on the same schedule but run each one sequentially?

I have a few Type=oneshot services that I want to trigger at the same time, like a cron job, without race conditions. They are taxing on i/o of common resources, so should run in serial, but SystemD is designed to run things in parallel.

I read an article on Medium about this same problem, but I did not like the proposed solution as it sets up a chain of dependent services that start each other, so removing a link will break the whole chain. Like they mention, the benefits of separate services are isolation of logging & failures, and manual triggering if needed, etc.

Timers and units have a one-to-one relationship, so though I can set a timer per service for the same clock time, I need to be certain that SystemD won't run them in separate transactions, one slightly after another then consider them as not starting together (the docs say "and both units are being started"). Disabling the timer should stop all the services from being triggered, rather than needing to disable and enable individual timers. I should be able to disable any of the services, and not have that affect any of the other services (no chaining). It should not use Conflicts= because that causes a service with a conflict to stop the other, but each needs to continue until completion (or failure).

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论