adding quota-warning for dovecot + fixing dovecot conf

This commit is contained in:
Benjamin Sonntag 2012-08-25 11:29:36 +00:00
parent f0185462fe
commit 6ba876f10c
5 changed files with 21 additions and 4 deletions

1
.gitattributes vendored
View File

@ -531,6 +531,7 @@ src/functions_hosting.sh -text
src/mail_deletion.sh -text
src/mem_add -text
src/mem_del -text
src/quota-warning.sh -text
src/quota_delete -text
src/quota_edit -text
src/quota_get -text

View File

@ -116,7 +116,7 @@ default_pass_scheme = MD5
# user_query = SELECT dir AS home, user AS uid, group AS gid FROM users where userid = '%u'
# user_query = SELECT home, 501 AS uid, 501 AS gid FROM users WHERE userid = '%u'
#
user_query = SELECT mailbox.path AS home, domaines.compte AS uid, 1998 AS gid FROM mailbox JOIN address ON address.id = mailbox.address_id JOIN domaines on domaines.id = address.domain_id WHERE address.address = '%n'
user_query = SELECT userdb_home AS home, userdb_uid AS uid, 1998 AS gid, userdb_quota_rule AS quota_rule FROM dovecot_view WHERE user = '%u';
# If you wish to avoid two SQL lookups (passdb + userdb), you can use
# userdb prefetch instead of userdb sql in dovecot.conf. In that case you'll

View File

@ -1214,8 +1214,8 @@ plugin {
# Note that % needs to be escaped as %%, otherwise "% " expands to empty.
# quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95
# quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80
quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95
quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80
quota_warning = storage=95%% /usr/lib/alternc/quota-warning.sh 95
quota_warning2 = storage=80%% /usr/lib/alternc/quota-warning.sh 80
#quota = maildir
quota = dict:user::proxy::quotadict

View File

@ -26,7 +26,7 @@
# ----------------------------------------------------------------------
#
SETUID=mail_add mail_del quota_edit quota_get mem_add mem_del du.pl
SCRIPTS=sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh
SCRIPTS=sqlbackup.sh rawstat.daily quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh
LIBS=functions.sh functions_hosting.sh functions_dns.sh
BIN=$(DESTDIR)/usr/lib/alternc/

16
src/quota-warning.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/sh
PERCENT=$1
DOM="`echo $USER | sed -e 's/.*@//'`"
FROM="postmaster@$DOM"
msg="From: $FROM
To: $USER
Subject: Your email quota is $PERCENT% full
Content-Type: text/plain; charset=UTF-8
Your mailbox is now $PERCENT% full."
echo -e "$msg" | /usr/sbin/sendmail -f $FROM "$USER"
exit 0