Hi,

I've had several emails asking how to run sa-learn.

I have several users that are good about moving samples of ham
to a ham folder and have their spam filter to a spam folder.

I make a files containing a list of the domains to use:
 /home/vpopmail/domains/domlist.txt

For each domain, I make a list of the user's names:
 /home/vpopmail/domains/example.com/userlist.txt

Note both lists: all on one line seperated by one space

I make the script executable in /usr/bin and soft link it
to /etc/cron.daily.

Hope this helps.

Regards,

Nick


Here is the script I use:

~~ Begin spam-learn script ~~
#!/bin/sh
#
# Script to feed sa-learn from selected users
#
# Add the selected users to userlist.txt in vpopmail
# domain root. Add users on one line with one space
# between names but, no space or line feed at the end
# of the line.
#
# Add domains to domlist.txt in the same manner.
#
# Nick Hemmesch <[EMAIL PROTECTED]>
# March 24, 2005
#

DPATH=/home/vpopmail/domains
DLIST=${DPATH}/domlist.txt
DLEARN=`cat ${DLIST}`
for x in ${DLEARN}; do
        echo "Checking $x"
        USERLIST=${DPATH}/$x/userlist.txt
        SPAMUSER=`cat ${USERLIST}`
        for i in ${SPAMUSER}; do
                /usr/bin/sa-learn --spam ${DPATH}/$x/$i/Maildir/.spam/new/*
                rm -rf ${DPATH/$x}/$i/Maildir/.spam/new/*
                /usr/bin/sa-learn --spam ${DPATH}/$x/$i/Maildir/.spam/cur/*
                rm -rf ${DPATH}/$x/$i/Maildir/.spam/cur/*
                /usr/bin/sa-learn --spam ${DPATH}/$x/$i/Maildir/.ham/new/*
                rm -rf ${DPATH}/$x/$i/Maildir/.ham/new/*
                /usr/bin/sa-learn --spam ${DPATH}/$x/$i/Maildir/.ham/cur/*
                rm -rf ${DPATH}/$x/$i/Maildir/.ham/cur/*
                /usr/bin/sa-learn --sync
        done
done

exit 0
~~ End spam-learn script ~~



The following is a post on the old stable list that you may
find interesting:

~~~~~~~~~~~~~~~~

Subject: Re: [qmailtoaster-stable] Spam, revisited
From: Ulrik S. Kofod
Date: Fri, 12 Aug 2005 13:25:19 +0200 (CEST)

I have put this in a daily cron script. It searches through all domains
for folders called "not spam" and sa-learn the contens as ham and it
searches for folders called "spam" and sa-learn the contens as spam.
The last line deletes everything in all the spam folders.

Then your users should just move spam and ham into the folders, and
sa should get smarter every night.

#------------------
#find all ham folders
find /var/home/vpopmail/domains/ -iregex .*not.spam\/cur -exec sa-learn
--ham '{}'/*
\;

#find all spam folders
find /var/home/vpopmail/domains/ -iregex .*\\.spam\/cur -exec sa-learn
--spam '{}'/*
\;
find /var/home/vpopmail/domains/ -iregex .*\\.spam\/cur\/.* -exec rm '{}' \;
#------------------

brgds Ulrik

Miki sagde:
> Hi!
> I've been using this for about 3 months ago and it works perfectly. I've
got this
script in my contrab:
>
> echo "Examinando SPAM"
> /usr/bin/sa-learn --spam
> /home/vpopmail/domains/dob-world.com/spam/Maildir/new/*
> /usr/bin/sa-learn --spam
> /home/vpopmail/domains/dob-world.com/spam/Maildir/cur/*
> echo "Examinando NOSPAM"
> /usr/bin/sa-learn --ham
> /home/vpopmail/domains/dob-world.com/nospam/Maildir/new/*
> /usr/bin/sa-learn --ham
> /home/vpopmail/domains/dob-world.com/nospam/Maildir/cur/*
> rm -rf /home/vpopmail/domains/dob-world.com/spam/Maildir/new/*
> rm -rf /home/vpopmail/domains/dob-world.com/spam/Maildir/cur/*
> rm -rf /home/vpopmail/domains/dob-world.com/nospam/Maildir/new/* rm -rf
/home/vpopmail/domains/dob-world.com/nospam/Maildir/cur/*
/usr/bin/sa-learn --sync
>
> I've got two accounts for spam, [EMAIL PROTECTED] for spam mails and
[EMAIL PROTECTED] for false positives.
>
> bye!
>
>
> Jake Vickers wrote:
>
>> Seems like every time I write a new rule to get rid of SPAM, they
'chaange' the
spelling of words to get it past...  I've been reading about Bayesian
learning a
little, and have some questions concerning QMail and SpamAssassin.
>> I realize I can forward my SPAM messages to a special mailbox
>> ([EMAIL PROTECTED]) and then run the learning feature of SpamAssassin
(sa-learn
--spam --mbox ~/Mail/inbox). Will this work with QMail's mailbox style?  Has
anyone else tried this with QMail yet?  And if so, are there any special
considerations for Qmail-Toaster to enable this feature?
>> Thanks.

~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to