[Pkg-nginx-maintainers] Bug#863602: nginx: Restart should check conf files before stopping service

Olaf van der Spek olafvdspek at gmail.com
Fri Nov 23 09:02:15 GMT 2018


Op vr 23 nov. 2018 om 09:52 schreef Christos Trochalakis
<ctrochalakis at debian.org>:
> Yes, restarting Nginx is something that can be avoided, Nginx provides
> such utilities.

> You can just run something like `nginx -t && nginx -s reload`, that
> checks the config and the gracefully reloads nginx (no restart). If
> nginx configuration is not valid the script will return a non-zero
> exit status.
>
> >
> >I think the conf files should be checked in restart before the old
> >service is stopped.
>
> This is working in sysvinit systems but is not supported in systemd
> systems: systemd doesn't give an entrypoint for a pre restart command.

What about ExecStartPre?

> ExecStartPre=, ExecStartPost=

> Additional commands that are executed before or after the command in ExecStart=, respectively. Syntax is the same as for ExecStart=, except that multiple command lines are allowed and the commands are executed one after the other, serially.

> If any of those commands (not prefixed with "-") fail, the rest are not executed and the unit is considered failed.
>
> >Perhaps even better, but I'm not sure if systemd and nginx supports
> >this, would be for the new instance to be fully started before the old
> >one is stopped.
> >
>
> This can be done (in both sysvinit & systemd) systems by running
> `/etc/init.d/nginx upgrade` but in your case a binary upgrade is not
> needed, just a config reload (nginx -s reload).

Could "service nginx restart" use this same logic?
Users and packages probably don't know about nginx upgrade and will be
using the standard interfaces...

-- 
Olaf



More information about the Pkg-nginx-maintainers mailing list