[systemd-devel] How to run forking daemon with systemd in correct way, without errors?
lennart at poettering.net
Thu Nov 23 14:47:15 UTC 2017
On Do, 23.11.17 12:40, Gena Makhomed (gmm at csdoc.com) wrote:
> 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" -
If you use Type=forking, then you'll get away with not specifiying a
PID file in most cases, but it's racy as soon as you have more than
one daemon process, and nginx appears to be one of this kind, hence
please specify PIDFile=.
> Creating pid file from grandchild process is common UNIX pattern.
> Thousands of daemons are working in this way. Rewrite them all?
Well, the better written ones synchronize properly.
Lennart Poettering, Red Hat
More information about the systemd-devel