生活的美妙在于,不知道一下秒是惊艳还是伤神,时光流转,珍惜现在的拥有的时光
全部博文(276)
分类: Python/Ruby
2012-03-09 17:43:42
#!/bin/bash
tput setb 1
tput setf 4
while true
do
clear
echo '
****************************************
* sample free mem collect *
* version: 1.0 *
****************************************
'
seq -s= 1 100|sed -e 's/[0-9]//g'
date=`date +"%d%m%Y"`
echo -ne "USER:$USER\tHOST:$HOSTNAME\tDATE:$date"
echo
seq -s= 1 100 |sed -e 's/[0-9]*//g'
echo -e "1:查看系统内存统计;"
echo -e "2:查看系统内存统计,并写入当前日期时间的文件;"
echo -e "3:退出脚本;"
seq -s= 1 100 |sed -e 's/[0-9]*//g'
echo 'talen hao'
echo -n "请选择操作(1,2,3):"
read operate
case $operate in
1)
echo -n "请输入统计次数:"
read times
echo -n "请输入统计时间间隔(秒):"
read second
echo -n '开始提取:'
echo -e $time
free -c $times -s $second
echo "提取结束......"
break
;;
2)
time2=`date +%Y-%m-%d\_%T`
echo -n "请输入统计次数:"
read times2
echo -n "请输入统计时间间隔(秒):"
read second2
echo -n '开始提取:'
echo -e $time
free -c $times2 -s $second2 |tee $time2.log
echo "统计完成,详细请查看$time2.log"
break
;;
3)
echo "正在退出..."
exit
;;
*)
echo '输入数字错误,Enter键返回'
;;
esac
read opendoc
done
效果如下: