procmail
[Top] [All Lists]

Re: Forking - no, serious

2009-11-27 14:33:40
Hello Shane,

Am 2009-11-27 09:24:24, schrieb reti(_at_)igrin(_dot_)co(_dot_)nz:
Hey,
I have just noticed a small log entry associated with some process
intensive nested code that appears as "forking". Ok, fair enough.

With the recipe starting the nested code I c flag onward a copy of the
message which finishes immediately afterwards as another delivered recipe.

My question is, could the delivered recipe execute before the nested code
is finished and could all processes terminate at that point, or become
confused as to what is the last folder etc viz: could the anticipated flow
be disrupted completely by one arm of the fork delivering early ?

You have to let the :0c recipe waiting by doing something like:


----8<------------------------------------------------------------------
:0:
* ^To:(_dot_)*reti(_at_)igrin\(_dot_)co\(_dot_)nz
{
  :0c
  * ? for COUNT in $(seq 1 20) ; do if [ -f ~/.procmail.continue ] ; then rm -f 
~/.procmail.continue ; break ; fi ; sleep 1 ; done ; echo >/dev/null
  {
    TRAP=''
    .Folder_Copy/
  }

  :0
  {
    TRAP='touch ~/.procmail.continue'
    :0
    .Folder/
  }
}
----8<------------------------------------------------------------------

You should at least lock this block to let only ONE new message in.

The first :0c recipe check 20 seconds long for a file ~/.procmail.continue
before it continue normaly. If, in the meantime the  origanl  message  has
arrived the .Folder/ after delivery, TRAP will be executed and create  the
file ~/.procmail.continue which then is detected by the :0c recipe and the
delivery continue by removing the file, and echo blindely to gernerate and
ExitStatus of 0.  TRAP sould be set to nothing

The recipe is not tested, but it should work.

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>                 Michelle Konzack
<http://www.can4linux.org/>                   Apt. 917
<http://www.flexray4linux.org/>               50, rue de Soultz
Jabber linux4michelle(_at_)jabber(_dot_)ccc(_dot_)de           67100 
Strabourg/France
IRC    #Debian (irc.icq.com)                  Tel. DE: +49 177 9351947
ICQ    #328449886                             Tel. FR: +33  6  61925193
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

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