Am 17.05.2018 um 11:25 schrieb Igor Bukanov: > I have a service unit for nginx that uses Type=forking and PIDFile. > That works, but occasionally I see in the log a message like > > nginx.service: PID file /run/nginx/nginx.pid not readable (yet?) after > start: No such file or directory > > After investigating this father I see the reason for this is that > nginx creates the pid file in a child process, not in the parent (at > least this is how I interpret their code). As the parent may exit and > systemd may respond to it before the child writes the pid, that leads > to the above message. > > I can workaround that via replacing ExecStart=/usr/sbin/nginx with > something like: > > ExecStart=/bin/sh -c "set -e; /usr/sbin/nginx; while ! test -s > /run/nginx/nginx.pid; do sleep 0.1; done' > > but that busy waits. Is there any option to replace this hack via a > native systemd solution, like explicitly waiting for the pid file to > appear before considering the unit ready? this is a bug in nginx however, after many years with systemd on Fedora one needs yet to show me a service where you can't simply remove the PIDFile line and you are done