检测目录下大于800m文件
时间:2008-05-19 来源:jordanfang
#!/bin/sh
DIR="/home/admin/bin/logs"
cd $DIR
if [ $? -ne 0 ]
then
echo "there have no logfile DIR,please check the DIR's existence."
exit 2
fi
MAXFILE_SIZE=`ls -lS $DIR | grep -v total | head -1 | awk '{print $5}'`
if [ $MAXFILE_SIZE -gt 838860800 ]
then
echo `ls -lS $DIR | grep -v total | head -1 | awk '{print $9}'` "is larger than 800M"
exit 2
else
echo "That's ok,all logfile are not larger than 800M"
exit 0
fi
检测目录下大于800m文件
DIR="/home/admin/bin/logs"
cd $DIR
if [ $? -ne 0 ]
then
echo "there have no logfile DIR,please check the DIR's existence."
exit 2
fi
MAXFILE_SIZE=`ls -lS $DIR | grep -v total | head -1 | awk '{print $5}'`
if [ $MAXFILE_SIZE -gt 838860800 ]
then
echo `ls -lS $DIR | grep -v total | head -1 | awk '{print $9}'` "is larger than 800M"
exit 2
else
echo "That's ok,all logfile are not larger than 800M"
exit 0
fi
检测目录下大于800m文件
相关阅读 更多 +