From b90cf0612e5963849d0dfe22e95debe834e9abde Mon Sep 17 00:00:00 2001 From: "Aaron L. Zeng" Date: Sun, 29 Jan 2023 00:24:25 -0500 Subject: nixos/atop: Remove upgraded logfiles if not replaced Before this change, starting atop regularly caused a quadratic increase in the number of log files over time, as each daily log file was copied (multiple times) to a new file, and then left there because the upgrade was a no-op. This eventually led to atop being unable to start because the log file name became too long! --- nixos/modules/programs/atop.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/programs/atop.nix b/nixos/modules/programs/atop.nix index 2b14d7c7343..329dd9ccd62 100644 --- a/nixos/modules/programs/atop.nix +++ b/nixos/modules/programs/atop.nix @@ -150,6 +150,8 @@ in if ! ${pkgs.diffutils}/bin/cmp -s "$logfile" "$logfile".new then ${pkgs.coreutils}/bin/mv -v -f "$logfile".new "$logfile" + else + ${pkgs.coreutils}/bin/rm -f "$logfile".new fi done ''; -- cgit 1.4.1