procmail
[Top] [All Lists]

Re: putting in a time delay in a procmail script

2001-06-12 09:01:03
I suggested to Andreas,

 :0Wci condition_related_flags
 * conditions
 | sleep 5 # or however many seconds you want in the delay
  :0A action_related_flags: # no second colon if no need for local lockfile
  original_action

And ahe asked,

| How come you need a c flag here? Does procmail consider piping to a
| sleep function as a delivery?

Procmail considers feeding a message to a command as delivery (except with
a filter flag or variable capture syntax); it doesn't read ahead along the
line and wait to see what that command is before deciding whether to treat
the recipe as delivering or not.  Since sleep will not write the message
anywhere (in fact, it will not produce standard output at all), we give a
copy to the sleep command and let later recipes handle the original.

| While waiting for the sleep command to finish, how will procmail react to
| a new incoming mail?

A different invocation of procmail will be started to handle the other
message.

| Will it wait for the last mail to finish running the procmail script or
| will it start running to procmail scripts simultaneously?

The second procmail will go on about its business while the first one is
still doing its own, unless it needs to get a lockfile or a kernel lock that
the first procmail already has and hasn't yet given up.  If you really want
only one procmail to work at a time, use a global lockfile, but that is
rarely a good idea.

| If so, will the two scripts share their variables? (i.e.  i have a variable
| $SENDER in the script, will the two scripts have their own value of this
| variable, or will changing this variable in one of the scripts affect the
| other?)

Each will have its own environment.  Neither of the two can alter the other.

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

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