J
JARB
Guest
How do i create in Plesk 9.3 notyfication to admin and client if cleint mailbox is full
Please help
this shel script will be work on plesk 9.3 Debian ?
Please help
this shel script will be work on plesk 9.3 Debian ?
#! /bin/sh
# warn plesk mailbox users, if mailbox exceeds quota
#
#setenv QMAILUSER 'do-not-reply'
MAILROOT=/var/qmail/mailnames
ADMINMSG=''
cd $MAILROOT > /dev/null
for DIR in *.*;do
QUOTAFILE=$MAILROOT/$DIR/@mbox.quota
# if domainquota exists
if [ -f $QUOTAFILE ]
then
DOMAINHARDQUOTA=`cat $QUOTAFILE`
DOMAINSOFTQUOTA=$((85 * $DOMAINHARDQUOTA / 100))
#echo "$DIR $DOMAINHARDQUOTA - $DOMAINSOFTQUOTA"
cd $MAILROOT/$DIR
for MAILBOX in * ;do
if [ -d $MAILBOX ]
then
# look for specific mailbox quota file and set mailbox softquota
QUOTAFILE=$MAILROOT/$DIR/$MAILBOX/@mbox.quota
#echo $QUOTAFILE
if [ -f $QUOTAFILE ]
then
HARDQUOTA=`cat $QUOTAFILE`
#echo "using specific $QUOTAFILE, $HARDQUOTA"
SOFTQUOTA=$((85 * $HARDQUOTA / 100))
else
#echo "using domainquota"
HARDQUOTA=$DOMAINHARDQUOTA
SOFTQUOTA=$DOMAINSOFTQUOTA
fi
# calculate space used by mailbox
MBOXSPACE=`du -ks $MAILBOX | cut -f1`
#echo "$MAILBOX@$DIR uses $MBOXSPACE"
if [ $HARDQUOTA -gt 0 -a $MBOXSPACE -gt $SOFTQUOTA ]; then
MBOXPERCENT=$(($MBOXSPACE * 100 / $HARDQUOTA))
echo "$MAILBOX@$DIR belegt $MBOXSPACE kb, Soft/Hardquota = $SOFTQUOTA kb /$HARDQUOTA kb"
#for testing: send warn mail to postmaster account
#mail -r do-not-reply@$DIR -s "Mailbox Quota Warnung" [email protected] << EOF
#
#regular: send warn mail to mailbox
mail -r do-not-reply@$DIR -s "Mailbox Quota Warnung" $MAILBOX@$DIR << EOF
Dear $MAILBOX
Your Mailbox currently uses $MBOXSPACE kb ($MBOXPERCENT %) on the mailserver. We would like to
remind you that your mailbox may only contain $HARDQUOTA kb.
To avoid problems when receiving new mail, you should remove read mail from the server.
Regards,
mailbox-robot
EOF
fi
fi
done;
fi
done;
cd /root/bin
Last edited by a moderator: