diff --git a/cpu.sh b/cpu.sh index 3add5a9..3b7a999 100755 --- a/cpu.sh +++ b/cpu.sh @@ -25,7 +25,9 @@ SEEN=$(ls -1 /tmp/vm* | awk -F'/' '{print $3}') OUT=$(ps -uU _vmd | awk -v var="${THRESHOLD}" '$12 !~ /\// && $3 > var {print $12}') if [ -z "$OUT" ]; then echo "No VM over the threshold overload" - rm -rf /tmp/vm* + if ls /tmp/vm* 1> /dev/null 2>&1; then + rm -rf /tmp/vm* + fi fi for VM in ${OUT}; do