Hi,
I have a recipe that invokes a script which inserts data into a database
based on a custom parsing routine.
That is all working fine, however sometime the database in question will be
down for one reason or another.
When this happens, I want procmail to abort processing and requeue the
message for later processing.
My current script is:
########################## procmailrc ###########################
## ##
## Processes incoming mail and passes messages to the mail ##
## processing script. ##
## ##
## Last Modified on 02/04/2003 by MAA ##
## ##
#################################################################
###################### Variable Declaration #####################
LOGFILE="${HOME}/scripts/logs/"`date +"%y%m%d"`"_procmail.log"
DEFAULT="${HOME}/Mail/incoming/"`date +"%m%d%y"`
DB_CHECK="${HOME}/scripts/db_check.sh"
PROCESSOR="${HOME}/scripts/MailProcessor.sh"
# VERBOSE=yes
####################### Recipie Execution #######################
LOCKFILE=procmail.lock # Create the lockfile, ensuring
# one procmail process at a time
:0wc
| echo "---" >> $LOGFILE # Message seperator (readability)
:0wci
| $DB_CHECK # Verify DB online
DB_ONLINE = $? # Capture the return value
:0 # Is the DB offline?
* ! $DB_ONLINE ?? 0
{
EXITCODE = 75 # Requeue the message
LOCKFILE # Release the lock file
HOST # Exit immediatly
}
:0wci
| mkdir -m 755 -p $DEFAULT # Make sure mail directory exists
:0wc
$DEFAULT # Save message to mail directory
MESSAGEFILE = $LASTFOLDER # Capture path of saved message
:0w
| $PROCESSOR $MESSAGEFILE # Pass message to mail processor
LOCKFILE # Release the lockfile
########################## End of File ##########################
Everything is working fine except the requeuing. I had done some searching
and found that setting the EXITCODE to 75 results in requeuing, so I put it
in, but the message never gets reprocessed.
What am I doing wrong? Help!
;-)
Matt Anderson
****************************************************************************
This email may contain confidential material.
If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail