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:
parent
2ba8c30b4e
commit
8164b71bf9
@ -137,6 +137,7 @@ in
|
|||||||
atop.preStart = ''
|
atop.preStart = ''
|
||||||
set -e -u
|
set -e -u
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
rm -f "$LOGPATH"/atop_*.new
|
||||||
for logfile in "$LOGPATH"/atop_*
|
for logfile in "$LOGPATH"/atop_*
|
||||||
do
|
do
|
||||||
${atop}/bin/atopconvert "$logfile" "$logfile".new
|
${atop}/bin/atopconvert "$logfile" "$logfile".new
|
||||||
@ -144,9 +145,9 @@ in
|
|||||||
# false positives for atop-rotate.service
|
# false positives for atop-rotate.service
|
||||||
if ! ${pkgs.diffutils}/bin/cmp -s "$logfile" "$logfile".new
|
if ! ${pkgs.diffutils}/bin/cmp -s "$logfile" "$logfile".new
|
||||||
then
|
then
|
||||||
${pkgs.coreutils}/bin/mv -v -f "$logfile".new "$logfile"
|
mv -v -f "$logfile".new "$logfile"
|
||||||
else
|
else
|
||||||
${pkgs.coreutils}/bin/rm -f "$logfile".new
|
rm -f "$logfile".new
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user