In systemd (v237 on UbuntuLinux 18.04 bionic), I can create a service file (for A.service
), and specify another service Requisite=B.service
. Meaning if I try to start A.service
and B.service
isn't already running, then A.service will not be started. It's a weak version of Requires
, which will start B.service
when I try to start A.service
.
Is there an opposite? Can I say “If B.service is running, then don't start this service” / “If B.service is running, then A.service cannot start”?
The docs say if I do Conflicts=B.service
, then starting A
will stop B and then start A. But I don't want B stopped, I just want A to fail to start. I want something that's to Conflicts
what Requisite
is to Requires
.
I could probably change the ExecStart
to be a shell command that'll fail is systemctl is-active B.service
or some sort of hack. Is there a proper solution?