Z-style
#!/bin/bash
Total=`free -m|grep Mem|awk \'{print $2}\'`
Use=`free -m|grep Mem|awk \'{print $3}\'`
UseRate=`echo "scale=2;$Use/$Total"|bc|awk -F \'.\' \'{print $2}\'`
IP=`/sbin/ifconfig|egrep -A 1 \'^eth1|^eth0:1\'|grep inet|awk \'{print $2}\'`
if [ $UseRate -gt 60 ]
then
   sync
   echo 3 > /proc/sys/vm/drop_caches
   total=`free -m|grep Mem|awk \'{print $2}\'`
   use=`free -m|grep Mem|awk \'{print $3}\'`
   userate=`echo "scale=2;$use/$total"|bc|awk -F \'.\' \'{print $2}\'`
   if [ $userate -gt 60 ]
   then
      echo "Utilization rate: $userate" | mail -s $IP zengxianhe@buka.tv
   fi
fi

 

分类:

技术点:

相关文章:

  • 2022-02-22
  • 2021-12-18
  • 2022-12-23
  • 2022-02-03
  • 2021-06-22
  • 2022-12-23
猜你喜欢
  • 2021-11-15
  • 2021-12-18
  • 2021-04-29
  • 2022-01-23
  • 2021-10-08
  • 2022-12-23
相关资源
相似解决方案