procmail
[Top] [All Lists]

Re: Run scr after all mail retrieved

1999-06-02 17:54:49
"David W. Tamkin" <dattier(_at_)Mcs(_dot_)Net> writes:

Harry Putnam asked,

| Summary: How to run a script from procmail after a mail retrieval
| sessation is complete.

Well, since procmail runs, using your .procmailrc, separately for each
message, anything in .procmailrc is going to be run separately for each
message, and that's the problem Harry's having.  To avoid its being run
once for each message, it has to be taken out of .procmailrc

So Harry, how is procmail (or formail -s procmail) invoked?  Can you go
up one level to the thing that calls procmail and have *it* run the script
after finishing with procmail?  Failing that, can you schedule the script
with cron?

Er  yes, I see your point.  I guess its just that procmail seems so
much easier to setup than some other apps.
I'm running Redhat linux 5.2 .  Its stock sendmail setup calls
procmail from sendmail.  So probably can be done in sendmail.cf.  I
suppose a `cron' job should be fine too, but it seemed cleaner to have
it done when mail fetching sorting etc is done.

Sendmail seems a little too complex for me to start mucking around in
its control files.  But with a little coaching I guess I'd try it.

I'm not sure of the full sequence of events but I call fetchmail to
retrieve mail.  If I put that call in a wrapper that waits for it to
finish and then calls the cleanup, would procmail still be running?
ie does fetchmail close down before procmail finishes its work?

At risk of showing the true depths of my ignorance:
Maybe put  a wrapper around sendmail itself.  Something like
symlinking `sendmail' to a wrapper script like?

#! /bin/sh
sendmail  && cleanup-script

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