PID file /var/run/*.pid not readable (yet?) after start--通用解决办法

nginx作为例子:
systemctl start nginx.service
报PID file /var/run/nginx.pid not readable (yet?) after start
但是启动成功。

解决办法:
/usr/lib/systemd/system/nginx.service
[service]PIDFile下一行增加 ExecStartPost=/bin/sleep 0.1
/bin/systemctl daemon-reload
/bin/systemctl restart nginx.service

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID

[Install] WantedBy=multi-user.target

你可能感兴趣的:(转载)