[systemd-devel] How to run forking daemon with systemd in correct way, without errors?
Gena Makhomed
gmm at csdoc.com
Thu Nov 23 10:40:38 UTC 2017
On 23.11.2017 2:30, Reindl Harald wrote:
>>>>> or just remove the pid-file stuff from the systemd-unit,
>>>>> systemd don't need it really
>> You are talking about GuessMainPID= option?
> no i talk about nearly 6 years systemd expierience in production and
> that i yet need to see a real world case where systemd don't work in
> case of missing PID file
You are argue not with me, you are argue with systemd documentation:
"...it is recommended to also use the PIDFile= option, so that systemd
can identify the main process of the daemon" -
https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=
>> You can read from documentation of this directive:
>> "The guessing algorithm might come to incorrect conclusions if a
>> daemon consists of more than one process."
>> nginx daemon consists of more than one process,
>> so directive MainPID= should be defined in unit file.
> i know that all, httpd and postfix are typically forking services and
> are working fine without any PID file since 2011
# grep PIDFile /usr/lib/systemd/system/postfix.service
PIDFile=/var/spool/postfix/pid/master.pid
httpd is not Type=forking service, it is Type=notify one.
# grep Type /usr/lib/systemd/system/httpd.service
Type=notify
>> In any case, you are talking about something like workaround of the bug,
>> but I am asking in systemd-devel mail list about root cause of this bug,
>> how to fix this bug, and where bug is located - in nginx or in systemd?
>
> in nginx which obviously creates the pid file too late
Creating pid file from grandchild process is common UNIX pattern.
Thousands of daemons are working in this way. Rewrite them all?
May be fixing systemd is far more simple than fixing all daemons?
--
Best regards,
Gena
More information about the systemd-devel
mailing list