1 |
Here's mine for mbox format: |
2 |
|
3 |
#!/bin/bash |
4 |
|
5 |
for user in /home/*/; |
6 |
do cd "$user"; |
7 |
if [ -d "mail" ]; then |
8 |
cd mail; |
9 |
if [ -f "Junk E-mail" ]; then |
10 |
cp "Junk E-mail" spam.$$ |
11 |
/usr/bin/sa-learn -u amavis -C /etc/mail/spamassassin --spam --mbox |
12 |
spam.$$ |
13 |
rm spam.$$ |
14 |
fi |
15 |
fi |
16 |
done |
17 |
|
18 |
On Sun, 2005-04-03 at 03:41 +0200, Scott Storck wrote: |
19 |
> Ben Munat schrieb: |
20 |
> |
21 |
> > Yeah, running sa-learn on an empty directory is fine, but it bugs me |
22 |
> > that when I then run rm on the contents of that directory, I get an |
23 |
> > error message. I know it doesn't hurt anything... it just bugs me. I |
24 |
> > thought it would be trivial to put the calls to "sa-learn" and "rm" in |
25 |
> > an if statement, but I guess I was wrong. |
26 |
> > |
27 |
> No, you are right, it is not hard you just need to know how to do it. |
28 |
> Here is part of my login script. |
29 |
> It does exactly what you want. |
30 |
> |
31 |
> ------snip-------------- |
32 |
> #change spamdir to the directoy you want to process |
33 |
> spamdir=/home/l0ner/.maildir/.spam |
34 |
> if ls -1 $spamdir 1>/dev/null 2>&1 |
35 |
> then |
36 |
> for spamdirfile in `ls -1 $spamdir` |
37 |
> do |
38 |
> spamfile=$spamdir/$spamdirfile |
39 |
> if test -f $spamfile |
40 |
> then |
41 |
> sa-learn --spam $spamfile |
42 |
> rm $spamfile |
43 |
> fi |
44 |
> done |
45 |
> fi |
46 |
> ------snip-------------- |
47 |
> |
48 |
> BTW, Don't forget to run it over ham too. SA needs to learn both ham and |
49 |
> spam for the bayes to function. :^) |
50 |
> |
51 |
> > b |
52 |
> |
53 |
> -l0ner |
54 |
> |
55 |
> -- |
56 |
> gentoo-server@g.o mailing list |
57 |
|
58 |
-- |
59 |
gentoo-server@g.o mailing list |