Need help with -Ns retraining while loop

Eric Wood eric at interplas.com
Wed Feb 25 15:25:03 CET 2004


Right now I have a cron job which basically runs the same command three
times:

/usr/bin/bogofilter -Ns < $spamfile
/usr/bin/bogofilter -Ns < $spamfile
/usr/bin/bogofilter -Ns < $spamfile
echo -n > $spamfile

It's just my way of guess-timating that a couple other people got the same
spam message and I want the make sure the scores get changes by a few points
at a time.

Now, I rather have bogofilter tell me the return code and only to
another -Ns for precise adjustments.  I'm not that great at shell script so,
can someone help me out?  This is what I what to do:

I've dragged one or more spam emails into $spamfile imap folder.  Cron calls
shell script every 5 minutes which does:
1. Create cron lock file - so cron done run this on top itself.
2. Split $spamfile into individual spam files; X=1; erase $spamfile
2. bogofilter < $spamfileX
3. Check exit code, if <>0 then /usr/bin/bogofilter -Ns < $spamfileX; goto
step 2.
4. erase $spamfileX, increment X; goto step 2
7. Erase lock.

This way I'm not training some arbitrary number of times.

Thanks,
-Eric Wood





More information about the Bogofilter mailing list