move SEEN below, exit 0 when nothing is found
This commit is contained in:
parent
fc76bc00de
commit
bfcf5fd779
6
cpu.sh
6
cpu.sh
|
@ -17,17 +17,14 @@
|
|||
THRESHOLD=90
|
||||
TTL=10
|
||||
GRACE=6
|
||||
#ps -uU _vmd | awk -v var="${THRESHOLD}" '$12 !~ /\// && $3 > var {print $12,$3}'
|
||||
#
|
||||
HOSTNAME=$(hostname)
|
||||
TIMESTAMP=$(date +%s)
|
||||
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"
|
||||
if ls /tmp/vm* 1> /dev/null 2>&1; then
|
||||
rm -rf /tmp/vm*
|
||||
fi
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
for VM in ${OUT}; do
|
||||
|
@ -66,6 +63,7 @@ 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
|
||||
echo "${s} - remove from tracking list"
|
||||
|
|
Loading…
Reference in New Issue