LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   issue with procmail recipe and external script (http://www.linuxquestions.org/questions/linux-server-73/issue-with-procmail-recipe-and-external-script-644961/)

nexus55 05-26-2008 10:09 PM

issue with procmail recipe and external script
 
Hiya,

I've got a problem with a procmail recipe which launches an external script:

MBASE=/var/qmail/mailnames/domain.com/orders
MBOX=${MBASE}/renewals
LOGFILE=${MBASE}/procmail.log
MFILE=${MBOX}/msg_${MDATE}

:0
* ^Subject: New Order Notice$
* !^X-Loop: PR$
{
:0 fhw
| formail -A "X-Loop: PR"

:0 c:
$MFILE

:0
| /var/qmail/mailnames/domain.com/orders/process_email.sh $MFILE
}

:0
${MBASE}/Maildir/

What I can't get working is the second rule, where all email gets delivered in ${MBASE}/Maildir/, it simply does not run. The issue is the external script that gets run (the script is run correctly, but after that the rest of the recipe is not run. It seems like procmail is hanging after that external script because the output isn't being redirected anywhere. And when I do redirect it, the script never gets run correctly.. This syntax also does not work:

"| /var/qmail/mailnames/domain.com/orders/process_email.sh $MFILE" >> /dev/null

so how do I do that redirect, without messing up the $MFILE parameter which that script needs to run properly.

Thanks in advance for any tips.

nexus55 05-27-2008 09:24 AM

I think I found the working solution, but I'll need to do some more testing on it.

instead of an action line beginning with | on the line that executes the shell script, I just assign the output of it to an arbitrary variable, making that recipe non-delivering.. Then the .procmailrc file seems to continue on as it should:

:0
RUNSHSCR=| /var/qmail/mailnames/domain.com/orders/process_email.sh $MFILE


All times are GMT -5. The time now is 06:53 PM.