Having already queried on the matter of syntax for restarting a server and having modified nginx.service
by adding Restart=always
for a few servers, a few weeks later I find the configuration file is devoid of this option.
Could I possibly have misconfigured the option in the wrong block ([Service]
) or is there a mechanism by which this file is overwritten and reset to a default state?
What is a sound approach to monitoring this situation, as one of the servers nginx has decided to fall over frequently (possibly daily - a suspect is letsencrypt renewal verifications process) ?
[Unit]
Description=A high performance web server and a reverse proxy server
Documentation=man:nginx(8)
After=network.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid
TimeoutStopSec=5
KillMode=mixed
[Install]
WantedBy=multi-user.target
/lib
(or/usr/lib
), or the file in/etc
? – Stephen Kitt Nov 28 '22 at 09:43/etc
. I do not recall which of/usr/lib
of/lib
but had noticed they were symlinked. Just checked: directory/etc/systemd/system
has no reference tonginx.service
in either of the servers – Jerome Nov 28 '22 at 09:47Restart=
, but why is that a concern? Your override file should only have[Service]
followed byRestart=…
. (Incidentally, if you have a comment on an answer, you should comment on the answer; I only got notified of your comment in this instance because I’d commented on the question myself.) – Stephen Kitt Nov 28 '22 at 10:03