On Mon, Mar 04, 2013 at 07:01:01PM +0100, Lennart Poettering wrote: > On Mon, 04.03.13 15:25, Belal, Awais (awais_be...@mentor.com) wrote: > > > > > Hi, > > > > So how do i write such a service i.e. when A starts B should be > > started first and when A is stopped B should be stopped as well. I am > > really new to this so any pointers here would be really helpful. I > > understand that this is a very basic question but I am very new to > > this... > > In this case write two normal .service files for these services. Then, > to link them together Add "BindTo=" to their [Unit] sections, pointing > to the other unit. This would then make sure, that if one is started, > the other is too, and if one is stopped the other is too, and both would > be equivalent (are they really? usually they aren't, but you description > above suggests two services where one cannot exist without the other, > and vice versa...). In addition to that add "After=B.service" to > A.service. (or, alternatively, "Before=A.service" to B.service, which > would be equivalent.) Please note that ordering deps are orthogonal to > requirement deps. That means that "BindTo=" does not imply ordering, and > hence you need both 'BindTo=' and 'After=' (or 'Before=') in the [Unit] > sections...
Lennart, I think we need a blog entry with clear description how to handle situations when service consist of multiple units. Some clear recommendation when to use BindTo=, PartOf=, targets and such. Pretty please :) -- Tomasz Torcz RIP is irrevelant. Spoofing is futile. xmpp: zdzich...@chrome.pl Your routes will be aggreggated. -- Alex Yuriev _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel