1、查询cpu使用情况
while :
do
idle=`top -bn1 | sed -n '3p' | awk '{print $4}' | cut -d . -f2`
use=$[100-$idle]
if [ $use -gt 90 ]
then
echo "cpu use percent too high."
#发邮件省略
fi
sleep 10
done
1、查询cpu使用情况
while :
do
idle=`top -bn1 | sed -n '3p' | awk '{print $4}' | cut -d . -f2`
use=$[100-$idle]
if [ $use -gt 90 ]
then
echo "cpu use percent too high."
#发邮件省略
fi
sleep 10
done