procmail
[Top] [All Lists]

Re: Again on setting a different exitcode for each mailbox

2007-11-19 07:24:50
Am 2007-11-10 18:03:41, schrieb M. Fioretti:
Hello,

a few weeks ago, I asked how to put together a procmailrc to be used
only from within a bash script launched from cron, with these
requisites:

- do NOT create extra versions of the processed messages
- return to the calling bash script an exit code which uniquely identifies
  the first procmail recipe which matched on the given message

Unfortunately, I have had time only in the last week to put together
and test all your precious suggestions, but after lots of trials
there's still something I missed, it seems.

With the bash script and procmailrc files below, I _always_ get
PROCMAIL_CHECK equal to 0, no matter which recipe matched, ie I get it
= 0 even on messages cc'ed to mfioretti(_at_)nexaima(_dot_)net or
marco(_at_)rule-project(_dot_)org, while I need it to be (in those cases and 
with
the code below) 52. Where is the error, and what needs to be changed?
Frankly, I'm a bit at loss on what to do next, so any help is really
appreciated.

I had the same problem with:

----8<------------------------------------------------------------------
PATH=${HOME}/bin:/usr/bin:/bin:/usr/sbin:/sbin
LOGFILE=${HOME}/log/procmail/`date +%Y-%m-%d`.log

NL="
"
:0
* ? ${HOME}/bin/tdprocmail-lock $$
{ 
  LOG="################ NEW MESSAGE AT `date '+%Y-%m-%d %H:%M:%S'` 
################${NL}"
}
ES=$?

:0E
{
  LOG="################ NEW MESSAGE AT `date '+%Y-%m-%d %H:%M:%S'` 
################${NL}"
  LOG="(.......)        TDProcmailLock    : was sleeping ${ES} second(s).${NL}"
}

MAILDIR=${HOME}/Maildir
DEFAULT=${MAILDIR}/

LINEBUF=65536

INCLUDERC=${HOME}/.procmail/procmailrc
----8<------------------------------------------------------------------

I was trying to lock the entired ~/.procmailrc and for testing
HOW long "tdprocmail-lock" has delayed the continuing, I used
the "ExitCode" by increasing each second a counter (0 to 127)
inside "tdprocmail-lock" and retun it as "ExitCode".

The sniplet is now working...  and the log looks like:

----8<------------------------------------------------------------------
################ NEW MESSAGE AT 2007-11-16 00:44:20 ################
(.......)       TDMailSerialnumber: Pass
(7872686)       FLT_received      : Pass [COUNT=0]
(7872686)       NET_sysmessages   : Pass
 Subject: Cron <michelle(_dot_)konzack(_at_)mail> tdmuttmailboxes --cron
  Folder: .SERVER.private_mail/new/1195170261.7483_0.mail.private          2315
################ NEW MESSAGE AT 2007-11-16 00:44:23 ################
(.......)       TDProcmailLock    : was sleeping 2 second(s).
(.......)       TDMailSerialnumber: Pass
(7872687)       FLT_received      : Pass [COUNT=0]
(7872687)       NET_sysmessages   : Pass
 Subject: Cron <michelle(_dot_)konzack(_at_)mail> tdmuttmailboxes --cron
  Folder: .SERVER.private_mail/new/1195170263.3795_0.mail.private          2315
################ NEW MESSAGE AT 2007-11-16 00:44:25 ################
(.......)       TDProcmailLock    : was sleeping 4 second(s).
(.......)       TDMailSerialnumber: Pass
(7872688)       FLT_received      : Pass [COUNT=0]
(7872688)       ML_divers         : Pass
(7872688)       BTS_Debian        : Pass
(7872688)       FLT_blacklist     : Pass [TLIST=blacklist]
(7872688)       FLT_spam_outlook  : Pass [WLIST=spam_outlook.whitelist]
(7872688)       FLT_ms_word_mail  : Pass [WLIST=spam_outlook.whitelist]
(7872688)       FLT_the_bat       : Pass [WLIST=spam_the_bat.whitelist]
(7872688)       FLT_spam_base64   : Pass
(7872688)       FLT_pdf           : Pass [WLIST=pdf.whitelist]
(7872688)       FLT_rtf           : Pass [WLIST=rtf.whitelist]
(7872688)       FLT_images        : Pass
(7872688)       FLT_subscribe     : Pass [TLIST=subscribe]
(7872688)       FLT_chinaspam     : Pass
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_rbl           : Deactivated
(7872688)       FLT_spam_sub      : Pass [TLIST=spam_sub]
(7872688)       FLT_spam_body     : Pass [TLIST=spam_body.domains]
(7872688)       FLT_spam_body     : Pass [TLIST=spam_body.words]
(7872688)       FLT_spamassassin  : Executable "spamc" not found.
From 
bounces+20071112-bug+2Dtracking+2Dsystem=freenet(_dot_)de(_at_)packages(_dot_)qa(_dot_)debian(_dot_)org
 Fri Nov 16 00:45:02 2007
 Subject: Bug#451015: [INTL:fi] Finnish translation of the debconf templates
  Folder: .BTS_debian.d.dash/new/1195170302.4960_0.mail.private            5438

<snip>

################ NEW MESSAGE AT 2007-11-16 21:15:50 ################
(.......)       TDMailSerialnumber: Pass
(7875962)       FLT_received      : Pass [COUNT=0]
(7875962)       NET_sysmessages   : Pass
 Subject: Cron <root(_at_)mail> tdmailfilter
  Folder: .SERVER.private_mail/new/1195244150.2776_0.mail.private           672
################ NEW MESSAGE AT 2007-11-16 21:20:07 ################
(7680447)       FLT_received      : Pass [COUNT=0]
(7680447)       FLT_schrott       : Pass
(7680447)       My_Progs          : Pass
(7680447)       FLT_cced          : Pass
(7680447)       ML_divers         : Pass
(7680447)       FLT_subject       : Pass
(7680447)       Peoples           : Pass
(7680447)       BUSINESS_firms    : No whitelist given.
(7680447)       FLT_blacklist     : Pass [TLIST=blacklist]
(7680447)       FLT_spam_outlook  : Pass [WLIST=spam_outlook.whitelist]
(7680447)       FLT_ms_word_mail  : Pass [WLIST=spam_outlook.whitelist]
(7680447)       FLT_the_bat       : Pass [WLIST=spam_the_bat.whitelist]
(7680447)       FLT_spam_base64   : Pass
(7680447)       FLT_pdf           : Pass [WLIST=pdf.whitelist]
(7680447)       FLT_rtf           : Pass [WLIST=rtf.whitelist]
(7680447)       FLT_images        : Pass
(7680447)       FLT_subscribe     : Pass [TLIST=subscribe]
(7680447)       FLT_chinaspam     : Pass
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_rbl           : Deactivated
(7680447)       FLT_spam_sub      : Pass [TLIST=spam_sub]
(7680447)       FLT_spam_body     : Pass [TLIST=spam_body.domains]
(7680447)       FLT_spam_body     : Whitelisted 
[WLIST=spam_body.words.whitelist, 
FROM=My(_dot_)Semiconductors(_at_)jumpstation(_dot_)nxp(_dot_)com]
(7680447)       FLT_spamassassin  : Executable "spamc" not found.
From 
enewserror(_at_)cdn(_dot_)easynet(_dot_)net(_dot_)c(_dot_)footprint(_dot_)net  
Fri Nov 16 21:20:25 2007
 Subject: Your latest NXP Semiconductors news (week 25)
  Folder: .ATTENTION.2007_25.linux4michelle/new/1195244440.3555_0.mail     4857
################ NEW MESSAGE AT 2007-11-16 21:20:41 ################
(.......)       TDProcmailLock    : was sleeping 11 second(s).
(.......)       TDMailSerialnumber: Pass
(7875963)       FLT_received      : Pass [COUNT=0]
(7875963)       NET_sysmessages   : Pass
 Subject: Cron <michelle(_dot_)konzack(_at_)mail> tdmuttmailboxes --cron
  Folder: .SERVER.private_mail/new/1195244442.5708_0.mail.private          2315
################ NEW MESSAGE AT 2007-11-16 21:20:50 ################
(.......)       TDMailSerialnumber: Pass
(7875964)       FLT_received      : Pass [COUNT=0]
(7875964)       NET_sysmessages   : Pass
 Subject: Cron <root(_at_)mail> tdmailfilter
  Folder: .SERVER.private_mail/new/1195244450.7244_0.mail.private           672
################ NEW MESSAGE AT 2007-11-16 21:25:23 ################
(.......)       TDMailSerialnumber: Pass
(7875965)       FLT_received      : Pass [COUNT=0]
(7875965)       NET_sysmessages   : Pass
 Subject: Cron <michelle(_dot_)konzack(_at_)mail> tdmuttmailboxes --cron
  Folder: .SERVER.private_mail/new/1195244723.10891_0.mail.private         2315
################ NEW MESSAGE AT 2007-11-16 21:30:06 ################
(7680447)       FLT_received      : Pass [COUNT=0]
(7680447)       FLT_schrott       : Pass
(7680447)       My_Progs          : Pass
(7680447)       FLT_cced          : Pass
(7680447)       ML_divers         : Pass
(7680447)       FLT_subject       : Pass
(7680447)       Peoples           : Pass
(7680447)       BUSINESS_firms    : No whitelist given.
 Subject: (week 25) Your latest NXP Semiconductors news
  Folder: .Business.NXP_Semiconductors/new/1195245006.11751_0.mail.pri     4740
################ NEW MESSAGE AT 2007-11-16 21:30:15 ################
(.......)       TDMailSerialnumber: Pass
(7875966)       FLT_received      : Pass [COUNT=0]
(7875966)       NET_sysmessages   : Pass
 Subject: Cron <root(_at_)mail> tdmailfilter
  Folder: .SERVER.private_mail/new/1195245015.13004_0.mail.private          672
----8<------------------------------------------------------------------


Note:  Since my Athlon XP 3000+ is gone, I run this Courier/Procmail
       server on a P2/350 with 384 MByte of memory.  It need around
       12 times longer then the Athlon and the Raid-5 controller is
       an AMI Megaraid Enterprise 1200 with eight (six in Raid and
       two hotfix) DDRS 39130 for the Maildirs.  OS is seperate on
       Raid-1 with three DDRS 39130.

Thanks, Greetings and nice Day
    Michelle Konzack
    Tamay Dogan Network
    Open Hardware Developer
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSN LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)


____________________________________________________________
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