Page 1 of 1

Batch Learn

Posted: 22 Jul 2016 14:58
by nicola.piazzi
It can be useful to query spamassassin database and learn bayes basing on results
In this batch file an example , we scan for messages that have RRWL_D in the report and then invoke sa-learn on the file using find on the message number (it is very simple to use also for learn spam) :


# hamlearn.sh
# Daily scheduled it train spamassassin regard some selected messages
# Put in cron
# 05 04 * * * /batch/hamlearn.sh

# Variables
Q="/var/spool/MailScanner/quarantine" # Quarantine folder
L="/usr/bin/sa-learn --ham --no-sync" # Message learn command


# START

# Retrieve in array m all message id that have RRWL_D in spamreport
vsql="SELECT id FROM maillog WHERE spamreport LIKE '%RRWL_D%';"
m=( $( echo $vsql | mysql -N -u root -p<YOURPASSWORD> -D mailscanner ) )

# Scan array and learn ham
for i in ${m[@]}; do
# Learn
find $Q -type f -name $i | $L
done

Re: Batch Learn

Posted: 19 Aug 2016 10:48
by pdwalker
Nicola,

You should make one definitive post for the RRWL feature. You have posts everywhere and newcomers might find it confusing.

Include the latest code and features (like using the batch learn script above)

Re: Batch Learn

Posted: 21 Aug 2016 16:21
by shawniverson