FS#42581 - [nginx] nginx.service not containing ExecStartPre with nginx configtest

Attached to Project: Arch Linux
Opened by Thore Bödecker (foxxx0) - Monday, 27 October 2014, 18:56 GMT
Last edited by Bartłomiej Piotrowski (Barthalion) - Tuesday, 28 October 2014, 07:10 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Sébastien Luttringer (seblu)
Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

The default nginx.service file shipped with the current archlinux stable package does not perform nginx config testing before startup.

I followed the nginx wiki page and discovered some suggested/alternative nginx.service files which had that enabled and I'm suggesting that this should be included by default.

Just add 'ExecStartPre=/usr/bin/nginx -t -c /etc/nginx/nginx.conf' right before the ExecStart= line. This way it would not even be attempted to start nginx if the previos configtest fails and exits with non-zero.


Additional info:
* package version(s):
nginx 1.6.2-2

* config and/or log files etc.:
/usr/lib/systemd/system/nginx.service


Steps to reproduce:
Install package 'nginx' and check the above mentioned default service file for the missing ExecStartPre line.
This task depends upon

Closed by  Bartłomiej Piotrowski (Barthalion)
Tuesday, 28 October 2014, 07:10 GMT
Reason for closing:  Won't implement
Comment by Johannes Löthberg (demize) - Monday, 27 October 2014, 19:35 GMT
Seems barthalion removed it in https://projects.archlinux.org/svntogit/packages.git/commit/trunk/service?h=packages/nginx&id=885b4bfad after moving nginx to extra, but it isn't actually useless since it will be run before restarting the service on `systemctl restart` and if it fails it won't stop the old one, leaving you with a working nginx instance until you can fix the config in case a config change accidentally broke something.
Comment by Bartłomiej Piotrowski (Barthalion) - Monday, 27 October 2014, 21:07 GMT
Correct me if I'm wrong, but there is no way to tell systemd to run one command, but do not restart the service when it fails. The service will be stopped first, and then ExecStartPre will be executed, leaving you with broken config anyway. ExecRestartPre hangs on systemd todo for quite a long time, but apparently no one cares enough to contribute the patches.
Comment by Johannes Löthberg (demize) - Tuesday, 28 October 2014, 00:56 GMT
Ah, sorry, seems I was mistaken, thought it was checked before restarting. (Has it always been like this, or did it use to try ExecStartPre before restarting?)
Comment by Bartłomiej Piotrowski (Barthalion) - Tuesday, 28 October 2014, 07:09 GMT
ExecStartPre is run, but between stopping and starting nginx. Nothing has changed about it.

Loading...