nixpkgs 中的 nagiossystemd.services.nagios.serviceConfig.Restart="always";
使日志混乱journalctl -u nagios
,应该是 Restart="no"; 反而!
MySQL修复
对于 MySQL,这有效:
systemd.services.mysql.serviceConfig = {
Restart = "always";
RestartSec="10s";
StartLimitInterval="1min";
};
由于 MySQL 服务没有列出任何“Restart”、“RestartSec”或“StartLimitInterval”,我想。
尝试 nagios 修复
使用与之前 MySQL 相同的 nagios 机制,我尝试:
systemd.services.nagios.serviceConfig.Restart = "no";
给我一个:
error: The option `systemd.services.nagios.serviceConfigRestart' defined in `/etc/nixos/configuration.nix' does not exist.
(use ‘--show-trace’ to show detailed location information)
如果我将其更新为:
systemd.services.nagios.serviceConfig = lib.mkForce { Restart = "no"; };
结果是其中的值systemd.services.mysql.serviceConfig
现在仅包含“重新启动”,但缺少重要的“执行开始”和其他服务定义:
journalctl -u nagios
nagios.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
最后使用这个:
systemd.services.nagios.serviceConfig = config.systemd.services.nagios.serviceConfig // { Restart = "no"; };
给我一个:
nixos-rebuild switch
error: infinite recursion encountered, at /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/attrsets.nix:199:44
(use ‘--show-trace’ to show detailed location information)