Merge pull request #95264 from flokli/nginx-config-reload

nixos/nginx: move configuration testing script into reload command
This commit is contained in:
Florian Klink 2020-08-12 18:47:02 +02:00 committed by GitHub
commit 22e8ada3b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -704,7 +704,10 @@ in
''; '';
serviceConfig = { serviceConfig = {
ExecStart = execCommand; ExecStart = execCommand;
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; ExecReload = [
"${execCommand} -t"
"${pkgs.coreutils}/bin/kill -HUP $MAINPID"
];
Restart = "always"; Restart = "always";
RestartSec = "10s"; RestartSec = "10s";
StartLimitInterval = "1min"; StartLimitInterval = "1min";
@ -761,8 +764,7 @@ in
serviceConfig.TimeoutSec = 60; serviceConfig.TimeoutSec = 60;
script = '' script = ''
if /run/current-system/systemd/bin/systemctl -q is-active nginx.service ; then if /run/current-system/systemd/bin/systemctl -q is-active nginx.service ; then
${execCommand} -t && \ /run/current-system/systemd/bin/systemctl reload nginx.service
/run/current-system/systemd/bin/systemctl reload nginx.service
fi fi
''; '';
serviceConfig.RemainAfterExit = true; serviceConfig.RemainAfterExit = true;