On Fri, 22 Sep 2006, Russell Jones wrote:

> @daily sa-learn --spam 
> /home/eggycrew/imap/eggycrew.com/rjones/Maildir/.INBOX.spam
> @daily sa-learn --ham /home/eggycrew/imap/eggycrew.com/rjones/Maildir/cur
> @daily sa-learn --ham /home/eggycrew/imap/eggycrew.com/rjones/Maildir/new

Put all your learns in a single shell script, and run that.

I also age the learn mailbox files to keep their sizes down when they
are learned, and I only learn if the file has been modified in the
last day or two.

Attached is the script I have in my cron.daily directory...

--
 John Hardin KA7OHZ    ICQ#15735746    http://www.impsec.org/~jhardin/
 [EMAIL PROTECTED]    FALaholic #11174    pgpk -a [EMAIL PROTECTED]
 key: 0xB8732E79 - 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
  False is the idea of utility that sacrifices a thousand real
  advantages for one imaginary or trifling inconvenience; that would
  take fire from men because it burns, and water because one may drown
  in it; that has no remedy for evils except destruction. The laws
  that forbid the carrying of arms are laws of such a nature. They
  disarm only those who are neither inclined nor determined to commit
  crime.               -- Cesare Beccaria, quoted by Thomas Jefferson
-----------------------------------------------------------------------
#!/bin/bash

#
# Train spamassassin global bayes filter
#

# learn from folders in user home dirs
#: echo "Learning from user local mailboxes"
for SPAM in `find /home/*/[Mm]ail -type f \( -name SpamAssassin-SPAM* -or -name 
spambox \) -mtime -3`
do
        if [ -s "$SPAM" ]
        then
                echo SPAM from $SPAM
                MBTYPE="--mbox"
                if [ "`file $SPAM | grep ' MBX mail '`" ]
                then
                        MBTYPE="--mbx"
                fi
                /usr/bin/sa-learn --spam -C /etc/mail/spamassassin $MBTYPE $SPAM
        fi
done
echo
for HAM in `find /home/*/[Mm]ail -type f \( -name SpamAssassin-HAM* -or -name 
hambox \) -mtime -3`
do
        if [ -s "$HAM" ]
        then
                echo HAM from $HAM
                MBTYPE="--mbox"
                if [ "`file $HAM | grep ' MBX mail '`" ]
                then
                        MBTYPE="--mbx"
                fi
                /usr/bin/sa-learn --ham -C /etc/mail/spamassassin $MBTYPE $HAM
        fi
done

# Report status
echo
echo "Bayes Statistics:"
/usr/bin/sa-learn --dump magic

chmod a+r /etc/mail/spamassassin/bayes_seen /etc/mail/spamassassin/bayes_toks

Reply via email to