Koozali.org: home of the SME Server
Obsolete Releases => SME 9.x Contribs => Topic started by: Jáder on January 16, 2016, 03:54:41 PM
-
I created a script to see if my users are using LearnAsSpam folder:
[root@andorinha ~]# cat ContaEmailsLearnAsSpam.sh
echo
echo
echo
pushd /home/e-smith/files/users/ >>/dev/nul
for u in `ls | grep -v admin`
do
emails=`ls -1 $u/Maildir/.LearnAsSpam/cur |wc -l`
if [[ $emails > 0 ]]; then
echo "Usuario: $u LearnAsSpam: $emails"
fi
done
popd >>/dev/nul
echo
And this is today report:
[root@andorinha ~]# ./ContaEmailsLearnAsSpam.sh
Usuario: gcontratos LearnAsSpam: 412
Usuario: gustavo LearnAsSpam: 802
Usuario: michel LearnAsSpam: 228
Usuario: sec_dir LearnAsSpam: 10
Usuario: tecnico2 LearnAsSpam: 1
Usuario: vendas02 LearnAsSpam: 123
I think some directories were not analised. I doubt "gustavo" received 802 spam in only a daY.
How can I run script by hand and see errors ?
Thanks
Jáder
-
Is the LearnAsSpam cron job running? If so, are you sending the output to /dev/null, or is it being emailed to root?
Do the counts from your script change to zero if you run /usr/bin/LearnAsSpam.pl manually?
Does sa-learn --dump magic indicate that your system is learning spam (does the value for "nspam" go up)?
-
Hi
I do not have /usr/bin/LearnAsSpam.pl . Should it be installed with contrib?
[root@andorinha ~]# locate -i learnasspam|grep -v users
/etc/e-smith/skel/user/Maildir/.LearnAsSpam
/etc/e-smith/skel/user/Maildir/.LearnAsSpam/cur
/etc/e-smith/skel/user/Maildir/.LearnAsSpam/new
/etc/e-smith/skel/user/Maildir/.LearnAsSpam/tmp
/home/e-smith/files/BackupConfig/Utilitarios/ContaEmailsLearnAsSpam.sh
/root/ContaEmailsLearnAsSpam.sh
And yes, sa-learn numbers are increasing:
[root@andorinha ~]# sa-learn --dump magic
0.000 0 3 0 non-token data: bayes db version
0.000 0 647 0 non-token data: nspam
0.000 0 1256 0 non-token data: nham
0.000 0 120916 0 non-token data: ntokens
0.000 0 1451907781 0 non-token data: oldest atime
0.000 0 1452989630 0 non-token data: newest atime
0.000 0 1452988008 0 non-token data: last journal sync atime
0.000 0 0 0 non-token data: last expiry atime
0.000 0 0 0 non-token data: last expire atime delta
0.000 0 0 0 non-token data: last expire reduction count
[root@andorinha ~]#
-
ohhh...just discovered that those two scripts are not included on SME!
http://bugs.contribs.org/show_bug.cgi?id=1701#c25
So I'd like to ask about what version is SME9 aproved to install and process those e-mail to SA learn.
Regards
Jáder
BTW: I think we need to update wiki pages about these scripts (LearnAsSpam.pl and LearnAsHam.pl)
-
Did you start with the Learn (http://wiki.contribs.org/Learn) contrib, or did you setup Bayesian auto-learning manually?
Here's an old post about the Learn contrib: http://forums.contribs.org/index.php?topic=47762.0
Here you go; just for you ;-)
LearnAsSpam / LearnAs Ham (spam/ham training) (http://wiki.contribs.org/Email#LearnAsSpam_.2F_LearnAsHam_.28spam.2Fham_training.29)
-
I've started with AutoLearning from wiki e-mail page .
Thanks for wiki updates, but I think it lacks directions about where to put those downloaded files (.pl .cron).
BTW I prefer to create just one .cron file in cron.daily, so learn is just once a day.
edit: remove comment about missing info where to put files. :$ Sorry!
-
Here is a new version of my script... if someone care:
[root@andorinha ~]# cat ContaLearn.sh
echo
echo
date
declare -i tspam
declare -i tham
pushd /home/e-smith/files/users/ >>/dev/nul
for u in `ls | grep -v admin`
do
spam=`ls -1 $u/Maildir/.LearnAsSpam/cur |wc -l`
ham=`ls -1 $u/Maildir/.LearnAsHam/cur |wc -l`
if [[ $spam > 0 ]] || [[ $ham > 0 ]]; then
echo "Usuario: $u LearnAsSpam: $spam LearnAsHam: $ham"
fi
tspam=$tspam+$spam
tham=$tham+$ham
done
echo "-----------------------------------------------------------------------------"
echo " Total: Spam: $tspam Ham: $tham "
popd >>/dev/nul
echo
Now it counts HAM and SPAM to be learned and sum them at end! ;)
-
Anything we should (better) document on the wiki?