瘋狂帽客's Blog
You are already naked. There is no reason not to follow your heart. ~ Steve Jobs ~
Thursday, August 23, 2007
Shell Script: 計算CPU的使用率
#!/bin/bash
SUM=0
for i in `vmstat -n 1 10 | grep -v ^p | awk '{ print $15 }' | grep -v "id"`
do
SUM=`expr $SUM + $i`
done
SUM=`expr $SUM / 10`
BUSY=`expr 100 - $SUM`
echo "$BUSY%
"
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment