On 6/24/2013 11:59 AM, Ben Johnson wrote:
Hi, everyone,
I'm attempting to configure automated quota warnings for users and have hit a snag.
The script I'm using is as follows:
#!/bin/sh PERCENT=$1 MAILBOX=$2 DOMAIN=$3 cat << EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o "plugin/quota=dict:user::file:/var/vmail/%d/%n/.quotausage" From: postmaster@$DOMAIN Subject: Email quota warning - mailbox over $PERCENT% full [...]
When the script is triggered, here's what appears in the log:
Jun 24 11:16:53 host dovecot: quota-warning: Error: lda: Fatal: Unknown argument: plugin/quota=dict:user::noenforcing:file:/var/vmail/%d/%n/.quotausage Jun 24 11:16:53 host dovecot: master: Error: service(quota-warning): child 22415 returned error 64
If I paste the same on the command line, the message is delivered, as expected:
/usr/lib/dovecot/dovecot-lda -d user@example.com -o "plugin/quota=dict:user::noenforcing:file:/var/vmail/%d/%n/.quotausage" -p /tmp/test.txt
The problem seems to be that the -o switch isn't being interpreted correctly when dovecot-lda is called from within the script. -o is the correct switch, yes? From the manual at http://wiki2.dovecot.org/LDA :
-o name=value: Override a setting from dovecot.conf. You can give this parameter multiple times.
What am I missing here? Is some shell script escaping or similar required?
Thanks for any tips!
-Ben
I figured it out; I had copy/pasted part of the line
cat << EOF | /usr/lib/dovecot/dovecot-lda -d $USER -o
"plugin/quota=dict:user::file:/var/vmail/%d/%n/.quotausage"
from the documentation example and in so doing I neglected to use the correct variable name for the user/mailbox. In the documentation example, the variable is $USER, whereas I had named it $MAILBOX. This was causing the mailbox/user to be evaluated as an empty string (or null).
Everything works as expected using the correct variable name.
Oops!
-Ben