nginx-ilves/service
Arti Zirk b5c071a713 Check config before systemctl reload
Currently systemd does not support seperate ExecReloadPre command to
check if safe reload is possible.[0] It should be possible to emulate
similar behavior with multible ExecPreload lines but due to systemd
issue #11238 it is not currently possible.[1]

Current workaround is to tell systemd to ignore ExecReload command exit
code and put a oneliner shell script in there that checks if its safe to
reload nginx config files. Unfortunaly this does not give any feedback
on the running terminal if reload failed or not.

Fix for #11238 should land in systemd v243 some time in the future

[0] https://github.com/systemd/systemd/issues/2175
[1] https://github.com/systemd/systemd/issues/11238
2019-08-07 14:28:23 +03:00

18 lines
435 B
Plaintext

[Unit]
Description=A high performance web server and a reverse proxy server
After=network.target network-online.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
PrivateDevices=yes
SyslogLevel=err
ExecStart=/usr/bin/nginx -g 'pid /run/nginx.pid; error_log stderr;'
ExecReload=-/usr/bin/sh -c '/usr/bin/nginx -t && /usr/bin/nginx -s reload'
KillSignal=SIGQUIT
KillMode=mixed
[Install]
WantedBy=multi-user.target