nixos/atop: remove leftover *.new files before starting conversion

The pre-start script was actually trying to convert these leftover
`*.new` and even `*.new.new` files, and failing to do so because the
`*.new.new` files were being overwritten and removed before they were
converted.
This commit is contained in:
someplaceguy 2023-12-23 14:02:52 +00:00
parent 2ba8c30b4e
commit 8164b71bf9

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