都赖这经济危机!!!
现在要根据老的linux机器的系统消耗来配置新的机器。
所以要写个东西记录运行时的CPU、内存等的消耗情况。
也没学太好,就又搞了个命令的集合。
呵呵。
 
#!/bin/bash
########################################################################
#rsru.sh
#record_system_resources_usage.sh
#The script used to record the use of system resources.
#by shark巨菜
########################################################################
#define
IOSTAT_FILE=./iostatus.txt
DATE=`date +%Y%m%d---%r`
CPU_USAGE=`top -b -n 1|head -n 5`
MEM_USAGE=`free -m`
HCT=`ps aux| awk '{print $5 "\t" $6 "\t" $11}' |sort -nr|head -n 10`
#setup the time of the check
echo "#######################################################" >> $IOSTAT_FILE
echo "$DATE" >> $IOSTAT_FILE
echo "-------------------------------------------------------------------------" >>$IOSTAT_FILE
#check the cpu status
echo "$CPU_USAGE" >> $IOSTAT_FILE
echo "-------------------------------------------------------------------------" >>$IOSTAT_FILE
#check the memory status
echo "$MEM_USAGE" >> $IOSTAT_FILE
echo "-------------------------------------------------------------------------" >>$IOSTAT_FILE
#check the tasks status
echo "$HCT" >> $IOSTAT_FILE
 
会生成一个iostatus.txt的文件,水平有限还不能根据这些数据给出简明扼要的提示,只能自己看使用率了。
o(╯□╰)o