Again, thanks for the help - I obviously hadn't tried OnFailure= on it's own, so the suggestion was very useful.
]]>EDIT: There was a second... I think the second is that it often describes stuff very abstractly and doesn't include enough examples. I think examples make manual pages much, much easier to understand and systemd's seem rather lacking in this respect.
]]>I got the need for Before/After from the manual, though I might be misunderstanding it :
Conflicts=
Configures negative requirement dependencies. If a unit has a Conflicts= setting on
another unit, starting the former will stop the latter and vice versa. Note that this
setting is independent of and orthogonal to the After= and Before= ordering
dependencies.If a unit A that conflicts with a unit B is scheduled to be started at the same time
as B, the transaction will either fail (in case both are required part of the
transaction) or be modified to be fixed (in case one or both jobs are not a required
part of the transaction). In the latter case the job that is not the required will be
removed, or in case both are not required the unit that conflicts will be started and
the unit that is conflicted is stopped.
Why isn't OnFailed enough?
It might be, I can't remember if I tried that on its own. I was hoping the error message would suggest a course though, as there's a lot of combinations of settings here that all seem valid and don't seem to ruled out by the documentation. Some of which have thrown up that error message. I'm trying new things out though, as I get a chance.
EDIT:
Okay, I removed all the conflicts stuff and it worked. I'll mark as solved, though I'm still not quite sure I'm completely sure how it all ties together - eg why having Conflicts etc. stops OnFailure working.
Thanks for the nudge though.
Why isn't OnFailed enough?
]]>The systemd.unit man page says this about OnFailure
OnFailure=
Lists one or more units that are activated when this unit enters the 'failed' state.
I have this in the A.service file:
[Unit]
...
Conflicts=B.service
Before=B.service
OnFailure=B.service
...
There is also a corresponding Conflicts and After in B.service file.
I have tried with both B enabled and disabled, and each time I get the following error if A fails:
Sep 05 15:08:16 SKANKY systemd[1]: Unit A.service entered failed state.
Sep 05 15:08:16 SKANKY systemd[1]: Triggering OnFailure= dependencies of A.service.
Sep 05 15:08:16 SKANKY systemd[1]: Failed to enqueue OnFailure= job: File exists
I've obviously misunderstood something and misconfigured something, but I can't see what. Web and forum searches don't help.
I can post the actual files, but my misunderstanding seems to be more general than specific here, so I'd like to avoid sidetracks into the specifics of the services involved.