procmail
[Top] [All Lists]

Scripting Issues: -m absolute & locking messages

2002-09-13 09:26:22
Ok.. Previous messages have been kind of broad reaching.  Let me take some
time to try and show where I am and whats going on.. We are very close to
having our solution but a few things have crept up which I'm not sure how
to solve.

Running procmail v3.22

We have 3 files in play, an rc file, a filter-email.sh script, and a
move-message.sh script.  The only two that are of real concern are the
outer script (filter-email.sh) and the rc file, the move message is
handled appropriatly since its the backend of outer scripts.

What are the files:

# filter-email.sh
#!/bin/bash

export MF_HOME=/home/vmail
export MF_RC_FILE=$MF_HOME/etc/filter-email.rc

MF_DOMAIN=pgdc.com
MF_ACCOUNT=operator

while read MF_DOMAIN MF_ACCOUNT; do
  for MF_FILE in $MF_HOME/domains/$MF_DOMAIN/$MF_ACCOUNT/new/*; do
    export MF_DOMAIN MF_ACCOUNT MF_FILE
    procmail -p -m test.rc < $MF_FILE
  done
done <$MF_RC_FILE

------
# test.rc
SHARED_DEST=$MF_HOME/systems/.PGDC.$MF_ACCOUNT.

:0
| /home/vmail/bin/move-message.sh ${SHARED_DEST}virii

------

First to the absolute issue.  If we change test.rc to
<absolutepath>/test.rc we get :

procmail: Error while writing to "/home/vmail/bin/move-message.sh"
procmail: Lock failure on "/var/spool/mail/vmail.lock"
procmail: Error while writing to "/var/spool/mail/vmail"

The actual rc file is never called because move-message is never executed
(that file just creates an echo-log of what occurs, in this instance it is
not created)

If we specify just test.rc like the script above it runs fine but again we
get the same errors:

procmail: Error while writing to "/home/vmail/bin/move-message.sh"
procmail: Lock failure on "/var/spool/mail/vmail.lock"
procmail: Error while writing to "/var/spool/mail/vmail"

Couple excerpt lines from move-messages created move.log file:

mv /home/vmail/domains/pgdc.com/operator/new/1031932589.18789_4.nexus
/home/vmail/systems/.PGDC.operator.virii/new
mv /home/vmail/domains/pgdc.com/operator/new/1031932589.18789_2.nexus
/home/vmail/systems/.PGDC.operator.virii/new
mv /home/vmail/domains/pgdc.com/operator/new/1031932589.18789_6.nexus
/home/vmail/systems/.PGDC.operator.virii/new

Sooo.. How do you get an absolute path to work with the setup?  We are
trying to allow each user to have their own .rc file within the directory
structure.  We thought of a cd to hack but thats a kludge at best.  The
second issue is the locking, we don't need locking since each filename
being handled is unique and overwriting is impossible.  I'm sure I have a
few other faux pas in here that I would really really love if someone
could take a stab at.. any help is greatly appreciated.

Once this is all done I'll doc it up and throw it on a site so if others
need a post-filter processing there is a general idea/framework.  In the
future we are thinking about putting this in front of postfix's virtual
delivery agent for prefiltering but thats the future ;)

Thanks again,

-a




_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>