cluster/services/ways: only reload nginx if actually running

This commit is contained in:
Max Headroom 2024-11-09 16:57:54 +01:00
parent 05b584c748
commit d16dd6de7b

View file

@ -89,11 +89,11 @@ in
'') consulServiceWays;
in pkgs.writeText "ways-upstreams.ctmpl" (lib.concatStringsSep "\n" (lib.unique upstreams));
destination = "/run/consul-template/nginx-ways-upstreams.conf";
exec.command = [
"${config.services.nginx.package}/bin/nginx"
"-s" "reload"
"-g" "pid /run/nginx/nginx.pid;"
];
exec.command = lib.singleton (pkgs.writeShellScript "ways-reload" ''
if ${config.systemd.package}/bin/systemctl is-active nginx.service; then
exec ${config.services.nginx.package}/bin/nginx -s reload -g 'pid /run/nginx/nginx.pid;'
fi
'');
}
];
};