View Single Post
  #11  
Old 12th January 2010, 19:45
bluebirdnet bluebirdnet is offline
Member
 
Join Date: Dec 2009
Location: Montreal, Canada
Posts: 50
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Quote:
Originally Posted by mixo View Post
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
that looks good thanks Mixo!
Reply With Quote
Sponsored Links