天天看点

每2秒获取系统的赋值及内存使用率

由于公司内部测试需要,需每隔2秒获取系统的负载与内存使用率,在此记录一下,做个备案,留个案底 `^_^!

脚本如下

结果如下

代码如下

#!/bin/bash

  2

  3 #*******************************************************************

  4 #**                                                               **

  5 #  comment template files contents read and cp from ./modules.sh

  6 #  Auth by Qrui QQ:516059158

  7 #  HTTP://cnblogs.com/ruiy

  8 #**                                                               **

  9 #*******************************************************************

 10

 11 for i in `seq 1 10000`;do

 12 #echo `sleep 3&&uptime&&free -m` >> realtime_upload_record.txt

 13 #echo "========================" >> realtime_upload_record.txt

 14 #echo decolltor>> realtime_upload_record.txt

 15 #echo "========================" >> realtime_upload_record.txt

 16

 17   echo `sleep 2&&uptime;free -m` >> realtime_upload_record.txt

 18   echo "=========row decolltor line by Qrui=========" >> realtime_upload_record.txt

 19   echo "" >> realtime_upload_record.txt

 20 done

完整shell代码下载地址http://files.cnblogs.com/ruiy/loop.zip

 修正后的最终版本;