View Single Post
  #10  
Old 11th December 2009, 23:33
mixo mixo is offline
Junior Member
 
Join Date: Aug 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have written such a script.
I will be glad if anyone uses it
Code:
#!/bin/bash

/usr/sbin/repquota -au |grep web| sed 's/ \+/ /g' | cut -f1,3,4 -d" " | while read LINE
do
USED=`echo $LINE | cut -f2 -d" "`
QUOTA=`echo $LINE | cut -f3 -d" "`
# TO AVOID DIVISION BY NULL LET'S INCREMENT QUOTA
let "QUOTA +=1"
#CALCULATE PERCENT
let RESULT=USED*100/QUOTA
if [ $RESULT -ge 90 ]&&[ $RESULT -lt 150 ]; then
     NAME=`echo $LINE | cut -f1 -d" "`
     # SEND MAIL
      SUBJ="-= Your mailbox is full =-"
      mutt  -s "$SUBJ" $NAME@example.ge < /usr/src/scripts/message.txt
fi
done
Reply With Quote