I want to search 10 maximum size of files in particular folder and if omscb* files is cross the thresh hold it will send mail to people to check and delete those files. lets assume If out of 10 files 3 files are starting from omscb* . I am using AIX . for example :- omscb1 5gb omscb2 7gb omscb2 3gb and other 7 files are not starting with omscb . So I have wriiten script below but output is coming that last file only which is omscb2 3gb because as per sorting , it is overwriting that current records . Kindly suggest how to get all the file names in output .
THRESHOLD="5"
LOG=/home/log1.txt
cd /home/var/log
du -sg *|sort -r|head -10 | awk '{print $1"\t"$2}' | while read LINE; do
PERC1=`echo $LINE |awk '{print $1}'`
PERC2=`echo $LINE |awk '{print $2}'`
if [ $PERC1 -gt $THRESHOLD ] || [ "$PERC2" = omscb* ] ;then
#echo $PERC1 $PERC2 \n >> ${LOG}
fi
done
print $LOG
============== Thanks in advance .
Aucun commentaire:
Enregistrer un commentaire