[systemd-devel] How to run forking daemon with systemd in correct way, without errors?

Gena Makhomed gmm at csdoc.com
Wed Nov 22 23:38:13 UTC 2017


On 23.11.2017 0:29, Reindl Harald wrote:

>>> or just remove the pid-file stuff from the systemd-unit, systemd 
>>> don't need it really

>> pid-file need for service reload and service stop

> nonsense

You are talking about GuessMainPID= option?

https://www.freedesktop.org/software/systemd/man/systemd.service.html#GuessMainPID=

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.

BTW, nginx has ability to change executable on the fly:
http://nginx.org/en/docs/control.html#upgrade

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?

> please read how systemd works

I read even sources of systemd and nginx.

But I still can't find *root cause* of this bug:

systemd: Stopping nginx - high performance web server...
systemd: Starting nginx - high performance web server...
systemd: PID file /var/run/nginx.pid not readable (yet?) after start.
systemd: Started nginx - high performance web server.

-- 
Best regards,
  Gena


More information about the systemd-devel mailing list