On Mon, 04.03.13 15:25, Belal, Awais ([email protected]) 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 -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
