procmail
[Top] [All Lists]

Re: call procmail, wait for return code

1999-12-15 09:40:57
Mark McCreary wrote,

| That is, if I have a shell script that calls procmail, I want procmail to
| completely finish the task before returning control to the shell script.

Now, that's the opposite of the usual question, where one wants to know how
to make procmail wait for the completion of a program that it invoked (and
for which the answer usually is to use the `W' or `w' flag on the recipe, as
Philip said).

| Therefore, if I call procmail 10 times in a loop, then all 10 jobs will end
| up running simultaneously.

That's odd.  What shell is running the script?  A thing like that should
happen only if you are backgrounding the procmail commands, I should think.

| I want to run the jobs one at a time, until completion, and then start the
| next job.

It seems that what you really want to do is to keep two procmails from
running at the same time, then.  It's not that the shell script has to wait
for procmail to finish before it runs the rest of the commands in the script;
it has to wait for procmail to finish before iterating the loop and running
procmail again.

A lot depends on the specifics of your script and your shell, Mark, but fault
of knowing those I'll give the most generic answer possible: use a global
lockfile in the procmail rcfile.  That way, if two procmails are in existence
at once, at least one will be doing nothing except waiting to get the lock.

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