"Martti M. Mela" <mmela(_at_)norssi(_dot_)oulu(_dot_)fi> writes:
I wonder how to set up a .procmailrc file, that tells
to my shell script that it should run..
I tried something like
# .procmailrc
PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin
LOGFILE=$MAILDIR/log
LOCKFILE=$HOME/.lockmail
:0:
* ^Subject:.*mode # It should activate, when there's that subject
| script.pl # I though that using pipe, it should work, but no..
How to continue? And when this works, this has nothing to do with other
mails, right?
I see 5.5 bugs:
1) You're using a global lockfile. Don't.
2) You failed to specify a name for the locallockfile, and the command
doesn't have a ">>" in it for procmail to figure it out itself.
3) You put a comment on the same line as a condition. You can't do that,
as it looks like a regexp containing '#'.
4) You didn't include the 'w' flag to have procmail check the return code
of the command for errors.
5) You forgot to turn on verbose logging via "VERBOSE = on"
5.5) You forgot to look in the logfile to see what procmail thinks is
happening; or if you did, you forgot to tell us what the logfile
contains.
Actually, if your script doesn't write to any files then no lockfile
is needed, but on the assumption that it does (what else is there for
it to do?):
LOGFILE=$MAILDIR/log
VERBOSE=on
:0w:script_running.lock
# It should activate when 'mode' is in the subject. Note that comments
# among the conditions only work in procmail 3.11preX. Personally I
# find they make the whole thing look cluttered...
* ^Subject:.*mode
| script.pl
Philip Guenther