cleaning the spam lists. Need some help with the script

VisiGod

Verified User
Joined
Jan 10, 2006
Messages
27
I've got a complain from a user that had about 160B of spam lists (in the user .spamassassin folder). I've found a nice util named trim_whitelist that will make the files smaller by removing the old entries.

I was trying to make a bash script that i could put on cron but i lack the knowledge for making it. Someone wants to help me ?

The tools can be downloaded from http://www.deepnet.cx/~kdeugau/spamtools/ and it's named "trim_whitelist". to use it just do (inside the /home/USERNAME/.spamassassin) the following:

perl trim_whitelist auto-whitelist

I would like to have some sort of bash script that would go all the user dirs and execute the command.

PS: I've changed the original script to delete the old file that the script copies

Thanks in advance for any ideas that popup
 
You can probably use the trim_whitelist script from a central location. If not, you could copy it into each users .spamassassin directory, but that's not likely needed.

Code:
#!/bin/sh

for u in `ls /usr/local/directadmin/data/users`; do
{
        perl /location/of/the/script/trim_whitelist /home/$u/.spamassassin/auto-whitelist
} done;

Edit: this will work as well probably.
 
Last edited:
bayes_seen

Hi Guys,

I'm having the same issues. In my users .spamassassin directories, the bayes_seen and auto_whitelist are pretty much taking up all of their disk space. Is there a way of 'auto cleaning' this files to keep them under control?

The script above works like a charm for the auto_whitelist, but what to do with the bayes_seen file?

Cheers!!
 
I haven't found a way to trim bayes_seen, and deleting them will cause SA to forget much of what it's learned.

I'm using the following to clean up auto_whitelist, bayes_journal, and bayes_toks.expire:

Code:
#!/bin/bash
for u in `ls /usr/local/directadmin/data/users`; do
    if [ -e /home/$u/.spamassassin/auto-whitelist ]
    then
        /usr/local/SA-tools/trim_whitelist.pl /home/$u/.spamassassin/auto-whitelist
        rm -f /home/$u/.spamassassin/auto-whitelist-old
        rm -f /home/$u/.spamassassin/bayes_toks.expire*
        /usr/bin/sa-learn --sync --dbpath /home/$u/.spamassassin/ -u $u
    fi
done;
 
Back
Top