I would like to run a custom script with dovecot once the user reaches certain percents of their quota.
The issue is that no matter what I try dovecot does not seem to execute my bash script.
90-quota.conf
plugin {
quota_warning = storage=95%% quota-warning 95 %u
quota_warning2 = storage=10%% quota-warning 10 %u
}
service quota-warning {
executable = script /var/www/lighttpd/mail/scripts/quotaWarning.sh
user = root
unix_listener quota-warning {
user = dovecot
mode = 0666
}
}
I have tried it with & without the user/mode/group arguments. I have also tried root/mail/dovecot users in all the different variations but with no luck at all.
quotaWarning.sh
#!/bin/sh
PERCENT="${1}"
USER="${2}"
cat <<EOF | /usr/libexec/dovecot/deliver -d [email protected] -c /etc/dovecot/dovecot.conf
From: [email protected]
Subject: Mailbox Quota Warning: ${PERCENT}% Full.
Mailbox quota report:
${USER}
* Your mailbox is now ${PERCENT}% full, please clear some files for further mails.
EOF
- The scripts permissions are set to 777 & I have has it with both user & groups of root & dovecot.
- Dovecot version is 2.2.7
- I am running CentOS 6.5 64bit
- Kernel: 2.6.32-042stab078.26
Any assistance would be awesome since I am now at a loss.
user =
username should be?You can configure Dovecot to run an external command when user's quota exceeds a specified limit. Note that the warning is ONLY executed at the exact time when the limit is being crossed, so when you're testing it you have to do it by crossing the limit by saving a new mail. If something else besides Dovecot updates quota so that the limit is crossed, the warning is never executed.
maildirsize
file doesn't always automatically update, so I have to remove it & then it recreates with the new correct size in it. Any idea's on that one? Also would there be a way to have themaildirsize
info saved into the mysql DB?