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!
This commit is contained in:
Aaron L. Zeng 2023-01-29 00:24:25 -05:00
parent 67bb3784f2
commit b90cf0612e

View file

@ -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
'';