coffee_cn

博客园 首页 新随笔 联系 订阅 管理
#!/bin/sh

#make by codfei

init()
{
IPADD=`ifconfig|grep 172.18|awk '{print $2}'|sed 's/addr://g'`;
NOWTIME=`date +%F-%H:%M`;
MAILTO="";
MAIL_SUB=" !**Report - Disk Capacity Report $NOWTIME **!";
tmpfile=/tmp/iamatmpfile.tmp
}

mhead()
{
        echo "" >$tmpfile;
        echo "From :$IPADD" >>$tmpfile
        echo "State :Report" >>$tmpfile
        echo "ReportBy:$0" >> $tmpfile
        echo "DateTime:$NOWTIME" >> $tmpfile
        echo "Info :codfei" >> $tmpfile
        echo "" >>$tmpfile;
}

smail()
{
mail -s "$MAIL_SUB" $MAILTO < $tmpfile

}
init;

for x in `df | grep /dev | awk '{print $5}' | sed 's/%//g'`
do

  if [ $x -gt 89 ]; then
  mhead;
  df -h >>$tmpfile;
  smail;
  exit 0;
  fi

done
posted on 2008-12-02 13:50  coffee  阅读(378)  评论(0编辑  收藏  举报