码迷,mamicode.com
首页 > 系统相关 > 详细

linux抓取load average数据

时间:2018-04-11 17:04:29      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:div   time   tee   done   lin   min   one   bin   uptime   

#!/bin/bash

echo ‘‘ > ~/getLoad/1minute.txt
echo ‘‘ > ~/getLoad/5minute.txt
echo ‘‘ > ~/getLoad/15minute.txt

#get load average data
oneminute=`uptime |awk {print $8}`
fiveminute=`uptime |awk {print $9}`
fifteenminute=`uptime |awk {print $10}`
SECONDS=0

# echo ${oneminute:0:4}

while [ $SECONDS -le 1200 ]
do
echo ${oneminute:0:4} >> ~/getLoad/1minute.txt
echo ${fiveminute:0:4} >> ~/getLoad/5minute.txt
echo ${fifteenminute} >> ~/getLoad/15minute.txt
sleep 2
done

 

linux抓取load average数据

标签:div   time   tee   done   lin   min   one   bin   uptime   

原文地址:https://www.cnblogs.com/wuzhiyi/p/8796605.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!