procmail
[Top] [All Lists]

How to get a count of processed msgs into procmail.log

2013-11-13 15:12:21
How can I get a count of processed mail into the procmail.log?

I've tried this sort of thing in a test .procmailrc inside a sandbox.

(From the top of the test .procmailrc)
  [...]
  LOG="$(echo 
  START
  Processing <$FILENO>)
  "
  [...]

In my sandbox setup that works just fine with FILENO printing the
count

In that setup procmail is being run like this:

Probably most readers here will know better than I do, what is happening
in the cmdline below... but just a brief sketch in case ...

 ( Note: `MakeMbox.pl' is just a script that turns 1 message per file
   setup into mbox format)

1) `ls' is displaying file names, most recent first, from a stock of
   single file per msg files

2) `sed' is limiting the number of files displayed so I can feed as few
   or many as I like.

3) makeMbox.pl is feeding the selected file names as an mbox stream to
   formail and procmail as shown


   makeMbox.pl `ls -t |

    sed -n '2,8p'` | 

     formail -e -s procmail -p -m /projects/reader/proc/trc

In that setup, the lines I posted near the top of this message:

   LOG="$(echo 
   START
   Processing <$FILENO>)
   "
 Cause procmail to enter into procmail.log the running total of the msgs being
 processed. 

 But the same lines used in my actual mail setup will not do the same
 thing.

 I'm guessing the cause is the way in which procmail is called is
 different in some way.

 In the actual setup, procmail is called in the usual way with a
 .promailrc file in ~/  

 Perhaps it is in order to show the whole top of the .procmailrc 
 used in my actual mail setup:

  #shell-script-*--
  PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
  SHELL=/bin/sh
  DEFAULT=/var/spool/mail/$LOGNAME
  MAILDIR=$HOME/spool
  LOGABSTRACT=ALL
  LOGFILE=/home/reader/t/var/log/procmail.log
  LOG="$(echo 
  START
  Processing <$FILENO>)
  "
  VERBOSE=YES
  
  PSCRIPTS="/projects/perl"
  SCRIPTS="/home/reader/scripts/"
  MAILARC="/home/reader/spool"
  
  TRAP='formail -XMessage-ID: && date +"%b %d %T%nSTOP"'
  
  [...]

The use of $FILENO in this case just shows an empty pair of '< >'s
entered in the log.

Can anyone suggest why that happens or perhaps suggest a better way to
keep a running count of msgs processed in the log?

____________________________________________________________
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>