[systemd-devel] Question about After/Before of services
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Thu Aug 9 02:56:05 PDT 2012
On 08/09/2012 10:04 AM, WANG Chao wrote:
> On 08/09/2012 01:59 PM, Zbigniew Jędrzejewski-Szmek wrote:
>> On 08/09/2012 06:28 AM, WANG Chao wrote:
>>> Hi, list
>>>
>>> As you see in the subject, this question comes from a lazy guy like me,
>>> who doesn't read the systemd source code at all :P
>> Hey, no need to read the source code :). Please see the man page:
>> http://www.freedesktop.org/software/systemd/man/systemd.unit.html
>>
>> Zbyszek
>>
> Hi,
>
> Trust me, I've read that section hundreds of times. I'm actually not
> that lazy ;)
>
> I come up with this confusion when I configure a service A 'wants' and
> 'after' B. I thought they should be started one by one in a exact order,
> but actually they intersected and run in parallel.
So: A after B, A wants B, means that when A is started, B will be
started first, and after B is started, A will be started second.
So the startup phase is sequential, but later on run in parallel.
Reading your post again, I think you might have something like startup
scripts in mind, where the first should finish _running_ and exit before
the second one starts. You can achieve this by adding
Type = oneshot
to the first service (or even to both of them).
You also say "right after": sorry, can't help you here. There's no way
to ensure that the system will not do some work in between.
Zbyszek
>>>
>>> The silly question is if A is configured to 'Wants:B' and 'After:B',
>>> will A start exactly after B is finished or after B is started?
>>>
>>> If A is started after B is started (still parallel somehow), is there
>>> anything I can do to control A to be started right after B is done?
More information about the systemd-devel
mailing list