Re: Sieve RFC5490 checks user quota usage
Nic Bernstein <[email protected]>
| Newsgroups | gmane.mail.imap.cyrus |
|---|---|
| Message-ID | <[email protected]> |
Paolo,
Attached is the script we've been using for ages for this purpose. Our
uses LDAP as a source of user ID information, but it could be easily
adapted for other AAA databases.
Cheers,
-nic
On 03/21/2017 10:59 AM, Paolo Cravero wrote:
>
> And for Nic, yes, I mean the "IMAP STORAGE quota". I would like to
> warn the user that his quota is about to fill up through an email,
> triggered on new mail arrival or login. Why? Because not all clients
> support reading the quota over IMAP or handling an alert (think of
> some smartphone IMAP client or an (active)sync system).
>
> Is there a way to achieve the same result somehow, with stock cyrus?
>
--
Nic Bernstein [email protected]
Onlight, Inc. www.onlight.com
6525 W Bluemound Road, Suite 24 v. 414.272.4477
Milwaukee, Wisconsin 53213-4073
----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus
quota-report.sh
(application/x-shellscript, 1.9 KB)
#!/bin/bash # # quota-report.sh - Script to report Cyrus IMAP quota issues to users # # Copyright (c) 2005 - 2017 # By Nic Bernstein <[email protected]>, for # # Onlight, Inc. # PO Box 511219 # Milwaukee, Wisconsin 53203 # # All rights reserved # Set the defaults for the LDAP search BIND_DN="uid=proxyuser,ou=admin,dc=example,dc=com" BIND_PW="secret" LDAP_HOST="ldap.example.com" BASE_DN="ou=People,dc=example,dc=com" FACILITY="local6.info" DEBUG="local6.debug" MINWARN=500000 # The minimum free space below which we bother, 500MB QCMD=/usr/lib/cyrus/bin/quota # Set the domain used in email addresses DOMAIN="example.com" DATE=`date +%D` logger -p $DEBUG -t quota-report "Beginning run on ${DATE}" # Run the quota command $QCMD -f | grep -v Quota | ( while read QUOTA PERCENT USED MB do USER=`echo $MB | cut -d "." -f 2` FREE=`expr $QUOTA - $USED` logger -p $DEBUG -t quota-report "Processing ${USER} with ${USED} of ${QUOTA}" if [ "${PERCENT}" -ge 80 -a $FREE -le $MINWARN ] then FNAME=`ldapsearch -h ${LDAP_HOST} -D ${BIND_DN} -b ${BASE_DN} -x -w ${BIND_PW} -LLL "(&(objectclass=person)(uid=$USER))" cn | grep ^cn | cut -d " " -f 2-` logger -p $DEBUG -t quota-report "${FNAME} is close to quota: ${PERCENT}%" if [ "${PERCENT}" -ge 90 ] then WARNING="PLEASE TAKE STEPS NOW!" else unset WARNING fi logger -p $FACILITY -t quota-report "User ${USER} at ${PERCENT}% of quota." /usr/sbin/sendmail -t <<-_EOF_ From: E-Mail Maintenance <postmaster@${DOMAIN}> To: ${FNAME} <${USER}@${DOMAIN}> Subject: E-Mail Quota Report for ${FNAME} on ${DATE} Your mailbox is nearing quota. Your quota is ${QUOTA} kilobytes and you are currently using ${USED} kilobytes, or ${PERCENT}%. You should delete messages which are no longer needed, and empty your trash to lower your usage. ${WARNING} Please contact IT support if necessary. Best regards, _EOF_ fi done ) logger -p $DEBUG -t quota-report "Ending run" # vim:tabstop=4:shiftwidth=4
nic.vcf
(text/x-vcard, 278 B)
begin:vcard fn:Nic Bernstein n:Bernstein;Nic org:Onlight, Inc. adr:Suite 24;;6525 W Bluemound Road;Milwaukee;WI;53213-4073;USA email;internet:[email protected] title:VP Operations tel;work:414-272-4477 x204 tel;cell:414-807-1734 url:http://www.onlight.com/ version:2.1 end:vcard