procmail
[Top] [All Lists]

Re: /var full, using duplicate removing

2001-12-03 20:04:37
On 3 Dec 2001, Pixel wrote:

Using procmail as mda for fetchmail, when /var is full, procmail fails
and so fetchmail keeps mail as expected on the server. Alas, on the 2
fetchmail the rule:

:0 Wh: msgid.lock
| formail -D 8192 msgid.cache

succeeds and the mails are dropped.

Is there any possibility to tell procmail to kill the msgid.cache when
procmail fails?

You need to do something like this (untested):

---- 8< ---- snip ---- 8< ----
# Keep the cache locked until final delivery is complete
LOCKFILE=msgid.lock

# Save the current cache and update it
:0 Wh
* ? cp msgid.cache msgid.save
| formail -D 8192 msgid.cache

# If the message wasn't in the cache, attempt delivery
:0:
$DEFAULT

# If delivery failed, treat it as I/O error
EXITCODE=74

# Restore the saved copy of the cache, discard the message
:0
* ? mv msgid.save msgid.cache
/dev/null
---- 8< ---- snip ---- 8< ----

This will leave the msgid.save file behind when delivery is successful, 
but that shouldn't affect the correctness of the next attempt.

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