writing a script to perform a function on each users mail folder
I have spamassassin working as a spam filter on my fileserver. I want to modify the setup so that spamassassin autolearns which emails are spam and which are not. I understand that it is best to do this using the spamassassin command sa-learn called through a cron task. sa-learn takes a directory as an input so it is possible to say "this folder contains spam" and teach spamassassin.
My problem is how to write the script that calls the sa-learn function for each of the system users. The users folder structure is something along the lines of Quote:
Would the best way be to use a for loop along the lines of Quote:
What commands can I use for these loops? Thanks. |
Hmmm... not to good with SpamAssassin as I don't run my own mail server, but if all your users are user1, user2, user3, user[...] then this should do the trick:
# sa-learn /mail/user*/spam if they're not, and they most likely aren't, try # sa-learn /mail/*/spam this should prevent you from having to modify the code. Now: if you have multiple directories in /mail, such as a /mail/etc (?) or something, you'll probably need to specifically exclude those directories if that's possible. Try the man pages for xarg, ls, and commands of that nature. Sorry if I couldn't be more help :) |
Thanks scuzzman. That works a treat. I was expecting a more complicated solution!
|
All times are GMT -5. The time now is 08:25 AM. |