summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2017-11-02 07:09:05 -0400
committerJesse Luehrs <doy@tozt.net>2017-11-02 07:09:16 -0400
commit3d1f14c4185da03720a93faf98242808ee286fc9 (patch)
treef01a29fe075c57de4dba2cdc0a60269aed51d057 /bin
parent6e5a0bf09c2f6d76bcd6d2db309d7f516e8b62be (diff)
downloadconf-3d1f14c4185da03720a93faf98242808ee286fc9.tar.gz
conf-3d1f14c4185da03720a93faf98242808ee286fc9.zip
and... actually fix the script
Diffstat (limited to 'bin')
-rwxr-xr-xbin/learn_spam16
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