Merge pull request #276318 from someplaceguy/u/fix-atop-start

nixos/atop: remove leftover `*.new` files before starting conversion
This commit is contained in:
7c6f434c 2023-12-24 18:18:56 +00:00 committed by GitHub
commit 79fee6027b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,6 +137,7 @@ in
atop.preStart = ''
set -e -u
shopt -s nullglob
rm -f "$LOGPATH"/atop_*.new
for logfile in "$LOGPATH"/atop_*
do
${atop}/bin/atopconvert "$logfile" "$logfile".new
@ -144,9 +145,9 @@ in
# false positives for atop-rotate.service
if ! ${pkgs.diffutils}/bin/cmp -s "$logfile" "$logfile".new
then
${pkgs.coreutils}/bin/mv -v -f "$logfile".new "$logfile"
mv -v -f "$logfile".new "$logfile"
else
${pkgs.coreutils}/bin/rm -f "$logfile".new
rm -f "$logfile".new
fi
done
'';