One way is to have all three services depend on the remaining two using Requires=
.
- one.service:
Requires=two.service three.service
- two.service:
Requires=one.service three.service
- three.service: etc.
This won't create a loop – dependencies are independent from startup ordering.
(That said, you should declare some Before= or After=, e.g. if kafka needs to run after zookeeper.)
The other method is to create a .target unit, have it depend on your three services, and the services be PartOf=
the unit. (Unfortunately it is not yet possible to have ConsistsOf= in the .target itself.)
- all.target:
Requires=one.service two.service three.service
- one.service:
PartOf=all.target
- etc.
(Again, you should additionally declare dependencies and ordering between the services; don't rely only on the .target starting everything.)
1thank you very much, I like in first approach, that I can start any of these services and all will come up in correct order. And second will come in handy for multi-starting services, which need not to be started always together. Thanks for both, I will use them — both. – Martin Mucha – 2018-10-23T19:04:07.293