sa-learn

--[UxBoD]-- uxbod at splatnix.net
Sat May 27 18:36:03 IST 2006


Hi,

i use MailScanner with Postfix and was wondering how I get newly spam entered to the bayes database.  I have created a little script
that polls our accounts :-

----------------------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash

LOCK_FILE=/var/lock/subsys/spam_check.lock

if [ -f ${LOCK_FILE} ]; then
	logger -p local0.info -t learn-spam "Still running !"
	exit
fi

touch ${LOCK_FILE}

for user in spam xyz abc
do
	typeset -i count=0

	for file in /home/${user}/.maildir/.LEARN-SPAM/cur/*
	do
		if [ -f ${file} ]; then
			sa-learn --spam ${file} && rm ${file}
			let count=${count}+1
		fi
	done 

	for file in /home/${user}/.maildir/.LEARN-HAM/cur/*
	do
		if [ -f ${file} ]; then
			sa-learn --ham ${file} && cat ${file} | \
			spamassassin -d > ${file} && mv ${file} /home/${user}/.maildir/cur
		fi
	done
done

if [ ${count} -gt 0 ]; then
	logger -p local0.info -t learn-spam "${count} email(s) processed"
fi

trap "rm -f ${LOCK_FILE}" exit

exit 0
----------------------------------------------------------------------------------------------------------------------------------------------------------

but for this to work I presume that it will need to be run as the effective user ie. Postfix ?

Thanks all.  And for UK people have a lovely Bank Holiday.

Phil

-- 
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean.



More information about the MailScanner mailing list