You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Peter Marshall <pe...@caris.com> on 2005/04/12 16:14:12 UTC

to sync or not to sync, that is the question - so confused

Hey,

I got this book (slightly outdated) called Spamassassin (by O'Reilly). 
Anyway, it says if you are going to sa-learn a bunch of directories in 
Maildir format you should do the following:

sa-learn --no-rebuild --spam mail/spam
sa-learn --no-rebuild ...........blah.....
sa-learn --no-rebuild --ham ...blah blah
salearn --rebuild

So I give that a go, and it gives messages to use sync and no-sync.

So I try again with those.  No errors this time, however, even after I 
get rid of all my mail (test account of course), in all directories, it 
still gives this output (which is different every time I run it ... here 
is the out put after each time.  I ran it 3 times)

-----first time
[test2@mailserv Maildir]$ /etc/bayes.sh
Learned from 2 message(s) (2 message(s) examined).
Learned from 0 message(s) (3 message(s) examined).
Learned from 0 message(s) (3 message(s) examined).
Learned from 3 message(s) (3 message(s) examined).
synced Bayes databases from journal in 0 seconds: 20 unique entries (20 
total entries)
Nothing to move in MissedSpam - cur
Nothing to move in NotSpam - cur


------Second time
[test2@mailserv Maildir]$ /etc/bayes.sh
Learned from 0 message(s) (2 message(s) examined).
Learned from 3 message(s) (3 message(s) examined).
Learned from 3 message(s) (3 message(s) examined).
Learned from 0 message(s) (3 message(s) examined).
synced Bayes databases from journal in 0 seconds: 24 unique entries (24 
total entries)
Nothing to move in MissedSpam - cur
Nothing to move in NotSpam - cur

-------Third Time
[test2@mailserv Maildir]$ /etc/bayes.sh
Learned from 2 message(s) (2 message(s) examined).
Learned from 0 message(s) (3 message(s) examined).
Learned from 0 message(s) (3 message(s) examined).
Learned from 3 message(s) (3 message(s) examined).
synced Bayes databases from journal in 0 seconds: 20 unique entries (20 
total entries)
Nothing to move in MissedSpam - cur
Nothing to move in NotSpam - cur


Note:  There is 1 message in the Inbox, and none anywhere else.

If I leave out the --no-sync options ... it gives no out put .. (i 
assume this means nothing got learned.)  Here is my script.

Do I need to sync ?  I am going to be running this for every user on the 
box (as that user of course) in a cron job.

-------------------The Script
#!/bin/sh

# Inbox
/usr/bin/sa-learn --no-sync --ham --dir ~/Maildir

# Spam Box
/usr/bin/sa-learn --no-sync --spam --dir ~/Maildir/.Spam

# Missed Spam
/usr/bin/sa-learn --no-sync --spam --dir ~/Maildir/.Spam.MissedSpam

# Not Spam
/usr/bin/sa-learn --sync --ham --dir ~/Maildir/.Spam.NotSpam

## Clean up spam Directories.
if [ "`\ls ~/Maildir/.Spam.MissedSpam/cur |wc -l`" -ne "0" ]; then
   mv ~/Maildir/.Spam.MissedSpam/cur/* ~/Maildir/.Spam
else
   echo "Nothing to move in MissedSpam - cur"
fi

if [ "`\ls ~/Maildir/.Spam.NotSpam/cur |wc -l`" -ne "0" ]; then
   mv ~/Maildir/.Spam.NotSpam/cur/* ~/Maildir/cur
else
   echo "Nothing to move in NotSpam - cur"
fi
---------------------------------------------------------------


Thank you for any help