Re: [systemd-devel] Question about After/Before of services

2012-08-09 Thread Zbigniew Jędrzejewski-Szmek
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

 
 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?
 
 
 

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about After/Before of services

2012-08-09 Thread WANG Chao

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.


Anyway, thanks for the rely.



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?





___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel




--
Thanks,
WANG Chao
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about After/Before of services

2012-08-09 Thread Zbigniew Jędrzejewski-Szmek
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?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about After/Before of services

2012-08-09 Thread Jóhann B. Guðmundsson

On 08/09/2012 04: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


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?


Yes

If A.service unit has Wants=B.service and After=B.service it will be 
start after B.service has finished starting *unless* B.service unit is 
Type=oneshot service then it will be started immediately after B.service 
is has been started not when B.service has finished starting...


JBG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about After/Before of services

2012-08-09 Thread Mirco Tischler
2012/8/9 Jóhann B. Guðmundsson johan...@gmail.com:
 On 08/09/2012 04: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

 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?


 Yes

 If A.service unit has Wants=B.service and After=B.service it will be start
 after B.service has finished starting *unless* B.service unit is
 Type=oneshot service then it will be started immediately after B.service is
 has been started not when B.service has finished starting...

 JBG

Or unless B.service is Type=simple (the default). In this case systemd
has no way to tell when B.service has finished starting and continues
to start A.service right away.

Mirco
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about After/Before of services

2012-08-09 Thread WANG Chao

On 08/09/2012 05:56 PM, Zbigniew Jędrzejewski-Szmek wrote:

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.


It matches what I saw. Make sense.


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


How could I miss this :(


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.



Sorry, when I said right after, I didn't mean right after.. Just 
after is fine.


Thanks for your help, I really appreciate it! I learn a lot :)


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?



--
Thanks,
WANG Chao
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Question about After/Before of services

2012-08-08 Thread WANG Chao

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


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?




--
Thanks,
WANG Chao
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel