Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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.com < /usr/src/scripts/message.txt
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment