Am 21.11.2014 um 15:53 schrieb Michael Meskes:
> Hi,
> 
> is this possible? Let's say I have services foo and bar. I can declare a
> conflict which results in bar being stopped automatically when foo is started.
> But what I'd need is the opposite, I'd like foo to be started automatically
> when bar is stopped. Is there any way to accomblish this?
> 
> I tried calling "systemctl start" in ExecStopPost but that sometimes gets 
> stuck
> (probably why Michael advised me to not do it anyway). Starting the service by
> hand (as in just running the binary) is not a solution, either, because the
> systemd doesn't know about it and apparently cannot stop it, in particular 
> when
> the opposite service is started again.
> 
> The last thing I came up with was to bring bar into failed state 
> automatically,
> but I'm afraid that has unplanned side-effects.
> 
> Or in other words: HELP! :)

Stopping a service, when another one is started, can be done by
declaring a Conflicts= (I think you figured that out already).
TTBOMK there is no mechanism to do the inverse.
There is FailureAction=, but that only is relevant if a service fails,
it's not run on a regular stop.


You could hook up wd_keepalive.service in shutdown.target, but that will
only deal with the shutdown case, not if the administrator runs
systemctl stop watchdog.service during runtime.

So yeah, maybe "ExecStopPost=/bin/systemctl start foo.service" is
currently the only option for this particular case. You could ask on the
upstream mailing list, to have further input though.

Do you know how other (systemd) distros handled watchdog.service?


If you go the systemctl start route, I'd suggest to at least add
--no-block, so the start request is scheduled, but systemctl doesn't
actually block for its completion.

Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Reply via email to