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

Clemens Gruber clemens.gruber at pqgruber.com
Thu Nov 23 09:52:22 UTC 2017


On Thu, Nov 23, 2017 at 01:22:21AM +0200, Gena Makhomed wrote:
> nginx is build with "--pid-path=/var/run/nginx.pid"
> and "PIDFile=/var/run/nginx.pid" is in nginx.service file.

OK.

> All ok with pid file, it located at /var/run/nginx.pid
> and no directive pid defined in nginx.conf file.

That's odd. Can you try this on a newer systemd version? Yours is pretty
old. I'm on systemd 235 (ArchLinux).
Maybe systemd 219 behaved differently for forking services?

And just to be sure, it behaves the same if you add the
pid /var/run/nginx.pid;
Or
pid /run/nginx.pid;
line to your nginx.conf ?
(Maybe it does not follow symlinks?)

I don't think nginx is doing anything wrong. This is working fine for
many people with and without systemd. There is even a similar example on
the nginx website:
https://www.nginx.com/resources/wiki/start/topics/examples/systemd/

Cheers,
Clemens


More information about the systemd-devel mailing list