Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-30 Thread Francis Moreau
On 06/29/2015 10:05 AM, Andrei Borzenkov wrote:
[...]

 service_sigchld_event() {
 ...
 } else if (s-control_pid == pid) {
 ...
 if (s-control_command 
 s-control_command-command_next 
 f == SERVICE_SUCCESS) {
 service_run_next_control(s);
 }

 this looks like that forking type services could had several commands
 queued in ExecStart directive...

 
 IIRC this is checked when unit definition is parsed.
 

I don't think so, service_sigchld_event() is called when a child process
of systemd has just died and the condition is testing if  the died
process is the process defined by ExecStart=.

Well it's my understanding, hence my confusion.

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


Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-29 Thread Francis Moreau
On 06/28/2015 07:21 PM, Reindl Harald wrote:
 
 
 Am 28.06.2015 um 19:02 schrieb Francis Moreau:
 On 06/28/2015 01:01 PM, Reindl Harald wrote:

 Am 28.06.2015 um 12:00 schrieb Francis Moreau:
 Hello,

 For services with Type=Forking, I'm wondering if systemd  proceeds
 starting follow-up units when the command described by ExecStart= exits
 or when the one described by ExecStartPost= exits ?

 I tried to read the source code to figure this out and it *seems* that
 the latter is true but I'm really not sure.

 after ExecStartPost because anything else would make no sense, a unit is
 started when *all* if is st started - see the recent mariadb units on
 Fedora - if systemd would fire up deaemons which depend on mariadb the
 whole wait-ready-stuff won't work

 Ok, then the next naive question would be: then what the purpose of the
 ExecStartPost= directive since several commands can already be 'queued'
 with the ExecStart= one?
 
 no, they can't, not for every service type
 When Type is not oneshot, only one command may and must be given
 
 read http://www.freedesktop.org/software/systemd/man/systemd.service.html
 

correct, I was actually confused by what I read from the source code:

service_sigchld_event() {
...
} else if (s-control_pid == pid) {
...
if (s-control_command 
s-control_command-command_next 
f == SERVICE_SUCCESS) {
service_run_next_control(s);
}

this looks like that forking type services could had several commands
queued in ExecStart directive...

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


Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-29 Thread Andrei Borzenkov
On Mon, Jun 29, 2015 at 11:01 AM, Francis Moreau francis.m...@gmail.com wrote:
 On 06/28/2015 07:21 PM, Reindl Harald wrote:


 Am 28.06.2015 um 19:02 schrieb Francis Moreau:
 On 06/28/2015 01:01 PM, Reindl Harald wrote:

 Am 28.06.2015 um 12:00 schrieb Francis Moreau:
 Hello,

 For services with Type=Forking, I'm wondering if systemd  proceeds
 starting follow-up units when the command described by ExecStart= exits
 or when the one described by ExecStartPost= exits ?

 I tried to read the source code to figure this out and it *seems* that
 the latter is true but I'm really not sure.

 after ExecStartPost because anything else would make no sense, a unit is
 started when *all* if is st started - see the recent mariadb units on
 Fedora - if systemd would fire up deaemons which depend on mariadb the
 whole wait-ready-stuff won't work

 Ok, then the next naive question would be: then what the purpose of the
 ExecStartPost= directive since several commands can already be 'queued'
 with the ExecStart= one?

 no, they can't, not for every service type
 When Type is not oneshot, only one command may and must be given

 read http://www.freedesktop.org/software/systemd/man/systemd.service.html


 correct, I was actually confused by what I read from the source code:

 service_sigchld_event() {
 ...
 } else if (s-control_pid == pid) {
 ...
 if (s-control_command 
 s-control_command-command_next 
 f == SERVICE_SUCCESS) {
 service_run_next_control(s);
 }

 this looks like that forking type services could had several commands
 queued in ExecStart directive...


IIRC this is checked when unit definition is parsed.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-29 Thread Francis Moreau
On 06/28/2015 07:35 PM, Andrei Borzenkov wrote:
 В Sun, 28 Jun 2015 19:02:57 +0200
 Francis Moreau francis.m...@gmail.com пишет:
 
 On 06/28/2015 01:01 PM, Reindl Harald wrote:


 Am 28.06.2015 um 12:00 schrieb Francis Moreau:
 Hello,

 For services with Type=Forking, I'm wondering if systemd  proceeds
 starting follow-up units when the command described by ExecStart= exits
 or when the one described by ExecStartPost= exits ?

 I tried to read the source code to figure this out and it *seems* that
 the latter is true but I'm really not sure.

 after ExecStartPost because anything else would make no sense, a unit is 
 started when *all* if is st started - see the recent mariadb units on 
 Fedora - if systemd would fire up deaemons which depend on mariadb the 
 whole wait-ready-stuff won't work


 Ok, then the next naive question would be: then what the purpose of the
 ExecStartPost= directive since several commands can already be 'queued'
 with the ExecStart= one ?

 
 Long running services (i.e. daemons) are represented by systemd with
 PID of main process (which is *the* service for systemd). With multiple
 ExecStart commands there is no obvious way to know which of started
 processes is the main one. That's the reason to allow just one command
 there. Once main process is known, it is possible to have any number of
 followup ExecStartPost commands.
 

I see, thanks.

So basically for type=Forking service, ExecStart= is used to find out
the PID of the main process, and additionnal commands can be passed
through ExecStartPost= and systemd will wait for the latter to be
finished before starting follow-up units.

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


[systemd-devel] Question about ExecStartPost= and startup process

2015-06-28 Thread Francis Moreau
Hello,

For services with Type=Forking, I'm wondering if systemd  proceeds
starting follow-up units when the command described by ExecStart= exits
or when the one described by ExecStartPost= exits ?

I tried to read the source code to figure this out and it *seems* that
the latter is true but I'm really not sure.

What about for services with other type (simple, oneshot) ?

Also the documentation says that only one command can be given to
ExecStart if the type of the service is Forking. However I don't see
this when reading the code:

service_sigchld_event() {
...
} else if (s-control_pid == pid) {

...
if (s-control_command 
s-control_command-command_next 
f == SERVICE_SUCCESS) {
service_run_next_control(s);
}

In my understand this code is specific to service with Type=Forking

Could anybody clarfify ?

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


Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-28 Thread Reindl Harald



Am 28.06.2015 um 12:00 schrieb Francis Moreau:

Hello,

For services with Type=Forking, I'm wondering if systemd  proceeds
starting follow-up units when the command described by ExecStart= exits
or when the one described by ExecStartPost= exits ?

I tried to read the source code to figure this out and it *seems* that
the latter is true but I'm really not sure.


after ExecStartPost because anything else would make no sense, a unit is 
started when *all* if is st started - see the recent mariadb units on 
Fedora - if systemd would fire up deaemons which depend on mariadb the 
whole wait-ready-stuff won't work




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-28 Thread Andrei Borzenkov
В Sun, 28 Jun 2015 19:02:57 +0200
Francis Moreau francis.m...@gmail.com пишет:

 On 06/28/2015 01:01 PM, Reindl Harald wrote:
  
  
  Am 28.06.2015 um 12:00 schrieb Francis Moreau:
  Hello,
 
  For services with Type=Forking, I'm wondering if systemd  proceeds
  starting follow-up units when the command described by ExecStart= exits
  or when the one described by ExecStartPost= exits ?
 
  I tried to read the source code to figure this out and it *seems* that
  the latter is true but I'm really not sure.
  
  after ExecStartPost because anything else would make no sense, a unit is 
  started when *all* if is st started - see the recent mariadb units on 
  Fedora - if systemd would fire up deaemons which depend on mariadb the 
  whole wait-ready-stuff won't work
  
 
 Ok, then the next naive question would be: then what the purpose of the
 ExecStartPost= directive since several commands can already be 'queued'
 with the ExecStart= one ?
 

Long running services (i.e. daemons) are represented by systemd with
PID of main process (which is *the* service for systemd). With multiple
ExecStart commands there is no obvious way to know which of started
processes is the main one. That's the reason to allow just one command
there. Once main process is known, it is possible to have any number of
followup ExecStartPost commands.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-28 Thread Reindl Harald



Am 28.06.2015 um 19:02 schrieb Francis Moreau:

On 06/28/2015 01:01 PM, Reindl Harald wrote:


Am 28.06.2015 um 12:00 schrieb Francis Moreau:

Hello,

For services with Type=Forking, I'm wondering if systemd  proceeds
starting follow-up units when the command described by ExecStart= exits
or when the one described by ExecStartPost= exits ?

I tried to read the source code to figure this out and it *seems* that
the latter is true but I'm really not sure.


after ExecStartPost because anything else would make no sense, a unit is
started when *all* if is st started - see the recent mariadb units on
Fedora - if systemd would fire up deaemons which depend on mariadb the
whole wait-ready-stuff won't work


Ok, then the next naive question would be: then what the purpose of the
ExecStartPost= directive since several commands can already be 'queued'
with the ExecStart= one?


no, they can't, not for every service type
When Type is not oneshot, only one command may and must be given

read http://www.freedesktop.org/software/systemd/man/systemd.service.html



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Question about ExecStartPost= and startup process

2015-06-28 Thread Francis Moreau
On 06/28/2015 01:01 PM, Reindl Harald wrote:
 
 
 Am 28.06.2015 um 12:00 schrieb Francis Moreau:
 Hello,

 For services with Type=Forking, I'm wondering if systemd  proceeds
 starting follow-up units when the command described by ExecStart= exits
 or when the one described by ExecStartPost= exits ?

 I tried to read the source code to figure this out and it *seems* that
 the latter is true but I'm really not sure.
 
 after ExecStartPost because anything else would make no sense, a unit is 
 started when *all* if is st started - see the recent mariadb units on 
 Fedora - if systemd would fire up deaemons which depend on mariadb the 
 whole wait-ready-stuff won't work
 

Ok, then the next naive question would be: then what the purpose of the
ExecStartPost= directive since several commands can already be 'queued'
with the ExecStart= one ?

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