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

Francis Moreau francis.moro at gmail.com
Mon Jun 29 00:58:29 PDT 2015


On 06/28/2015 07:35 PM, Andrei Borzenkov wrote:
> В Sun, 28 Jun 2015 19:02:57 +0200
> Francis Moreau <francis.moro at 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.


More information about the systemd-devel mailing list