cluster/services/ways: only reload nginx if actually running
This commit is contained in:
parent
05b584c748
commit
d16dd6de7b
1 changed files with 5 additions and 5 deletions
|
@ -89,11 +89,11 @@ in
|
||||||
'') consulServiceWays;
|
'') consulServiceWays;
|
||||||
in pkgs.writeText "ways-upstreams.ctmpl" (lib.concatStringsSep "\n" (lib.unique upstreams));
|
in pkgs.writeText "ways-upstreams.ctmpl" (lib.concatStringsSep "\n" (lib.unique upstreams));
|
||||||
destination = "/run/consul-template/nginx-ways-upstreams.conf";
|
destination = "/run/consul-template/nginx-ways-upstreams.conf";
|
||||||
exec.command = [
|
exec.command = lib.singleton (pkgs.writeShellScript "ways-reload" ''
|
||||||
"${config.services.nginx.package}/bin/nginx"
|
if ${config.systemd.package}/bin/systemctl is-active nginx.service; then
|
||||||
"-s" "reload"
|
exec ${config.services.nginx.package}/bin/nginx -s reload -g 'pid /run/nginx/nginx.pid;'
|
||||||
"-g" "pid /run/nginx/nginx.pid;"
|
fi
|
||||||
];
|
'');
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue