Auto learn from users folders

jordivn

Verified User
Joined
Nov 4, 2016
Messages
62
Hi All,

I created an small bash script to teach the bayes of all the users.

https://bitbucket.org/jordivn/wes-scripts/src/master/LearnBayesUserBased.sh

LearnBayesUserBased.sh
Script for teaching SA Bayes on an directadmin server. It loops thru every user => domain => mailbox => mailfolder. Only handmade folders (others then default) are used for HAM. Known spamboxes are used for SPAM. It downloads the spam file from http://artinvoice.hu/spams/$spamfile and teached it at SPAM. Then sync the journal and dumps the magic. All saved in an log (/var/log/sa-learn/) per user.

This can help to speed up the learning of the first 200 ham and spam messages for users who just enabled SA.

You could use this script in an daily cron. Then is speeds up the refreshment of the bayes tokens.

Feel free to use it. (At own risk ofcourse)
 
Hi Jordi,

this is super, just what I needed actually. This should replace the script at https://help.directadmin.com/item.php?id=358. How do you run this script, as a weekly cron? Could it be run as the mail user as well?

As a feature request, the ability to skip the main DirectAdmin "admin" account and the option to use the mail from the main account user with mail that's in /home/username/Maildir/.

Oh and since these maildirs are live and changing maybe find a way to stop the "archive-iterator: unable to open ...: No such file or directory" and "archive-iterator: no access to" errors?
 
Last edited:
It looks like the script should run as the user since it will bayes_toks file in their .spamassassin folder as rw so if you run as root for example the spamd script running as the user can't actually read the file. Maybe adding a chown $USER:$USER /home/$USER/.spamassassin/bayes_* after the sa-learn lines will help?
 
Last edited:
Back
Top