Hi,

Apologies in advance if this is the wrong list, but I wanted to confirm 
that what I have done is safe (and sensible).

I want to be able to automatically add keywords to incoming mail from 
procmail, so I added a recipe, and a helper script, which I've included 
below.

This seems to work really well, however, I wanted to confirm that it is 
sane:

1) Is this concurrent-safe? Is there a race if the MUA sees the mail and 
causes courier to move it from 'new' to 'cur' while the labelling is 
happening? Or does maildirkw cope with this safely?

2) I have IMAP_USELOCKS set to 1 in /etc/courier/imap. Do I need to do 
anything with my procmail recipes to make them use this locking too, or 
is this not necessary (I read elsewhere that maildir doesn't use locks at 
all, so I was a little confused).

3) Can you see any other problems with my approach below?

Many thanks in advance, and best wishes
Matt.

procmailrc:
## Labelling inbox stuff
:0
* <insert reg-exp here>
{
    :0
    { TRAP='/home/matt/bin/addlabel.sh \$Label5' }
}
<let mail fall into default folder>

The script, addlabel.sh looks like this:

#!/bin/bash

if [ "$1" == "" ] ; then
     echo "No keyword supplied!"
     exit 1
fi

folder=`dirname $LASTFOLDER`
folder=`dirname $folder`
msg=`basename $LASTFOLDER`

echo folder=$folder
echo msg=$msg

maildirkw -l -a $folder $msg $1

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to