Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2295119
  • 博文数量: 276
  • 博客积分: 5998
  • 博客等级: 大校
  • 技术积分: 5175
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 14:43
文章分类

全部博文(276)

文章存档

2014年(25)

2013年(11)

2012年(69)

2011年(167)

2010年(4)

分类: Python/Ruby

2011-09-20 09:53:56

#/bin/bash
dk_checkpoint_per=90
dk_checkpoint_num=5.5
echo $dk_checkpoint_num
mount_on='data1'
if df -h |grep $mount_on 2>&1 >/dev/null;then
        dk_percent=`df -h |grep $mount_on|awk '{print $5}'|sed 's/%//g'`
        dk_unused=`df -h |grep $mount_on|awk '{print $4}'`
else
        dk_percent=`df -h|sed -n '2p'|awk '{print $5}'|sed 's/%//g'`
        dk_unused=`df -h|sed -n '2p'|awk '{print $4}'`
fi
if `echo $dk_unused|grep 'M'`;then
        echo '分区'$mount_on'使用率_'$dk_percent'%剩余'$dk_unused''
        exit
else
        dk_unused_num=`echo $dk_unused|sed 's/G//'`

fi
echo $dk_percent
echo $dk_checkpoint_per
echo ${dk_unused_num}
if [[ $dk_percent > $dk_checkpoint_per ]] || [[ ${dk_unused_num} < ${dk_checkpoint_mum} ]]; then
        echo '分区'$mount_on'使用率_'$dk_percent'%剩余'$dk_unused''
        exit
        echo wwww
fi
echo kkkkkkkk
阅读(1384) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~