procmail
[Top] [All Lists]

Re: Detecting pine in procmail

1999-01-21 01:30:34
On Wed, 20 Jan 1999 16:07:35 -0500 (EST), Patrick Rogers
<progers(_at_)interlog(_dot_)com> wrote:
Usually I read my mail with pine, so essentially I want a procmail
recipe that will detect wether or not pine is running, and if not
process my pagerNames recipes. Is this possible? I realize it is
out of the scope of what a mail filter should do, but it would be
very useful.

It is fairly simple to +tell+ Procmail when you are using pine. If you
normally start it up with the command "pine" which executes the
program in /usr/local/bin/pine, you can simply put the following
wrapper in your $HOME/bin:

#!/bin/sh
if [ -f $HOME/.pine-running ]; then
  echo 'Oops, there already seems to be a copy of Pine running' >&2
  echo 'Issue the command rm -rf $HOME/.pine-running if this is not true' >&2
  exit 1
fi
trap 'rm -f $HOME/.pine-running' 1 2 3 15
touch $HOME/.pine-running
/usr/local/bin/pine
rm -f $HOME/.pine-running

You may have to change your PATH in your login files to make your
personal $HOME/bin version take precedence over the real pine.

Now you can change your .procmailrc where it says

    INCLUDERC=pagerNames.rc

to instead say

    :0
    * ! ?? test -f $HOME/.pine-running
    { INCLUDERC=pagerNames.rc }

Now, whenever you start up Pine, you will also create a flag file
which tells Procmail to not run the pager stuff. The file will be
removed when you quit Pine. If a flag file should be left hanging
around, the Pine wrapper script will complain.

I would also like some pointers to resources on how to have
procmail notify pine that there is mail in a folder (or configure
pine to notify me if there is mail in a folder other than the
inbox) and also pointers on how to trim the from and subject
headers before forwarding to my pager.

For the latter, man formail. You might want to check out the stuff at
<http://www.iki.fi/~era/procmail/links.html> -- and I know the Pine
notification issue has been dealt with before, so you could search for
old postings on this subject over at Achim Bohnet's searchable archive
at <http://www.rosat.mpe-garching.mpg.de/mailing-lists/procmail/>

Hope this helps,

/* era */

-- 
.obBotBait: It shouldn't even matter whether    <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>

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