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

Gena Makhomed gmm at csdoc.com
Wed Nov 22 22:02:01 UTC 2017


On 22.11.2017 23:27, Reindl Harald wrote:

>> I am use nginx web server (http://nginx.org/) with systemd.
>> But I see errors in /var/log/messages when running nginx:
>>
>> systemd: Starting nginx - high performance web server...
>> systemd: Failed to read PID from file /var/run/nginx.pid: Invalid 
>> argument
>> systemd: Started 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

> either the daemon needs to be fixed 

Ok, but can you tell, what is wrong with daemon?

this is nginx daemonization code:
http://hg.nginx.org/nginx/file/tip/src/os/unix/ngx_daemon.c

this is function for writing pidfile:
http://hg.nginx.org/nginx/file/tip/src/core/ngx_cycle.c#l944

> 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.

-- 
Best regards,
  Gena


More information about the systemd-devel mailing list