diff options
author | Jesse Luehrs <doy@tozt.net> | 2017-11-02 07:09:05 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2017-11-02 07:09:16 -0400 |
commit | 3d1f14c4185da03720a93faf98242808ee286fc9 (patch) | |
tree | f01a29fe075c57de4dba2cdc0a60269aed51d057 | |
parent | 6e5a0bf09c2f6d76bcd6d2db309d7f516e8b62be (diff) | |
download | conf-3d1f14c4185da03720a93faf98242808ee286fc9.tar.gz conf-3d1f14c4185da03720a93faf98242808ee286fc9.zip |
and... actually fix the script
-rwxr-xr-x | bin/learn_spam | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/learn_spam b/bin/learn_spam index 512aba9..ab5603a 100755 --- a/bin/learn_spam +++ b/bin/learn_spam @@ -13,20 +13,24 @@ else fi if [[ ! "$1" == "-q" ]]; then - echo -n "$(date): Learning ham..." + echo "$(date): Learning ham..." fi -nice find $MAILDIR -type f | perl -nl0e'chomp; print if m{/(new|cur)/} && !m{/spam/}' | xargs -n1000 -0 $SALEARN $OPTS --ham > $OUTFILE +nice find $MAILDIR -type f | \ + perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && !m{/(\.old|\.spam)/} && $ts > $now - 60*60*24*30' | \ + xargs -n1000 -0 $SALEARN $OPTS --ham > $OUTFILE if [[ ! "$1" == "-q" ]]; then - echo -n "$(date): Learning spam..." + echo "$(date): Learning spam..." fi -nice find $MAILDIR -type f | perl -nl0e'chomp; print if m{/(new|cur)/} && m{/spam/}' | xargs -n1000 -0 $SALEARN $OPTS --spam > $OUTFILE +nice find $MAILDIR -type f | \ + perl -nl0e'chomp; ($ts) = /(\d{10})/; $now = time; print if m{/(new|cur)/} && m{/\.spam/} && $ts > $now - 60*60*24*30' | \ + xargs -n1000 -0 $SALEARN $OPTS --spam > $OUTFILE if [[ ! "$1" == "-q" ]]; then - echo -n "$(date): Syncing..." + echo "$(date): Syncing..." fi nice $SALEARN --sync > $OUTFILE if [[ ! "$1" == "-q" ]]; then - echo -n "$(date): Done!" + echo "$(date): Done!" fi |