B
B
Boris192018-05-16 12:39:37
linux
Boris19, 2018-05-16 12:39:37

How to set up systemd?

Help set up dependencies in systemd. You need to organize two services according to the following algorithm:
1. The first service starts before the second, even if the second service was started first
2. If one service was stopped, then the other should also stop
3. If one of the services fell, the second should stop with the failed status.
As I understand it, you need to use Requires, After, Before. Then you can control the startup sequence. But I can’t make it so that if one service suddenly falls, then the second service also “falls”.

********************************
# Service1
[Unit]
Requires=service2.service
Before=service2.service
********************************
#Service2
[Unit]
Requires=service1.service
After=service1.service

Found the BindsTo parameter, which forces the service to stop if another one has fallen. But the truth is that the service in this case has the inactive status, and not failed as we would like.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mr. Podman, 2018-05-16
@Boris19

According to paragraph 2.3, I think this will do:
Read more man systemd.unit

A
Alexander, 2018-05-16
@alexr64

It's easier to combine 2 services into 1.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question