Linux查看某一进程的占用CPU的Cacti脚本
转自:http://hi.baidu.com/kobe_brian/blog/item/d0bd49004da2d11f4bfb5109.html以mysqld为例:
#!/bin/bash
top -n 1 > /root/top.log
if grep -q mysqld /root/top.log
then cpu=`grep "mysqld" /root/top.log | gawk '{ print $9 }'`
echo $cpu
else
echo "0"
fi
exit
页:
[1]