> The following is in my .procmailrc file
> PATH=$HOME/bin:/usr/bin:/usr/ucb:/bin:/usr/local/bin:.
> MAILDIR=$HOME/mail # You'd better make sure it exists
> LOGFILE=$MAILDIR/from
> LOCKFILE=$HOME/.lockmail
> SHELL=/bin/sh # for other shells, this might need adjustment
>
> :0c: LOCKFILE
> * ^From:(_dot_)yan(_at_)ns1(_dot_)wwisp(_dot_)com
> /usr/home/admin/yantemp
>
> :0a: LOCKFILE
> | ( /usr/home/admin/test;)
>
>
> What I want to do is for allmail come in from
yan(_at_)ns1(_dot_)wwisp(_dot_)com to be in
> /usr/home/admin/yantemp, which worked. now, after that, I want to run a
> perl script /usr/home/admin/test which operates on yantemp. the file name
> yantemp is already in the perl script so i don't have to put it in.
> However, my script did not run at all. I can manually run it and it
> worked, but when i put in in .procmailrc it did not run. What am I doing
> wrong ?
Try this:
:0
* ^From:(.*[^a-zA-Z0-9._-])?yan(_at_)ns1\(_dot_)wwisp\(_dot_)com
{
MAILDIR=/usr/home/admin
LOCKFILE=yantemp.lock
:0c
yantemp
:0c
|./test
LOCKFILE
}
Notes:
1. If you do not "copy" on the second recipe above, then when it
is performed, your mail processing will stop.
2. In your original recipe, there is a small window of time during which
new mail could arrive and be dropped before the "test" program could
be involed on the first mail. The only way to avoid this is to place
a lock around both the writing of the file, and the subsequent
processing of it.
3. The regexp in front of the "yan" allows comments to exist:
From: "The Great Yan" yan(_at_)ns1(_dot_)wwisp(_dot_)com
and to avoid false matches, such as with:
From: "The Brother of Yan" broyan(_at_)ns1(_dot_)wwisp(_dot_)com
4. If you write the Perl script "test" to read from STDIN, the recipe can be
made more simply, and avoid writing a file at all. Eg:
:0c
* ^From:(.*[^a-zA-Z0-9._-])?yan(_at_)ns1\(_dot_)wwisp\(_dot_)com
| /usr/home/admin/test
If "test" uses temporary files internally, it should provide its own
locking (use "lockfile" if necessary) or, you should place a local
lockfile on the recipe.
Also, be sure that "test" is executable, and has the correct path to perl
on the first line (eg: #!/usr/local/bin/perl).
G'luck.
___________________________________________________________
Alan Stebbens <aks(_at_)sgi(_dot_)com> http://reality.sgi.com/aks