add additional existence check for ls /tmp/vm*

This commit is contained in:
mischa 2024-05-15 09:52:07 +02:00
parent 1af95f8c98
commit 4353ba4d86
1 changed files with 9 additions and 7 deletions

16
cpu.sh
View File

@ -77,10 +77,12 @@ for VM in ${OUT}; do
fi
done
SEEN=$(ls -1 /tmp/vm* | awk -F'/' '{print $3}')
for s in ${SEEN[@]}; do
if [[ "${OUT[*]}" != *"${s}"* ]]; then
if [ -n "${DEBUG}" ]; then echo "${s} - remove from tracking list"; fi
rm -rf /tmp/${s}
fi
done
if ls /tmp/vm* 1> /dev/null 2>&1; then
SEEN=$(ls -1 /tmp/vm* | awk -F'/' '{print $3}')
for s in ${SEEN[@]}; do
if [[ "${OUT[*]}" != *"${s}"* ]]; then
if [ -n "${DEBUG}" ]; then echo "${s} - remove from tracking list"; fi
rm -rf /tmp/${s}
fi
done
fi