Re: Starting a service when stopping a different one

2014-11-26 Thread Michael Biebl
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?



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

Re: Starting a service when stopping a different one

2014-11-24 Thread Michael Meskes
 What is the underlying problem you're trying to solve?

That one daemon (namely wd_keepalive) needs to be started when another
daemon (namely watchdog) is stopped. The reason for that is that if the
kernel is configured with NOWAYOUT stopping watchdog will result in a
reset, maybe before shutdown is completed. wd_keepalive prevents that by
petting the watchdog some more.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at gmail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

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