Last active
April 26, 2020 19:53
-
-
Save flat235/4253d360feb5861ad7ed8db21a277701 to your computer and use it in GitHub Desktop.
Update spamassassin rules, bayes learning. Script for nightly cronjob.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# where are the maildirs? | |
MAILROOT=/var/vmail/ | |
DELETEDDIRS='deleted-maildirs' | |
SPAMDIRS='Spam' | |
# update rules | |
sa-update --allowplugins | |
# compile rules (for speed) | |
sa-compile --quiet | |
# learn from cur dirs only, mails, that are still new can be sorted into spam/not spam folders before being learned from | |
# exclude deleted maildirs | |
find $MAILROOT -name 'cur' -type d '!' -iregex ".*${DELETEDDIRS}.*" -iregex ".*${SPAMDIRS}.*" -exec sa-learn --no-sync --spam {} >> /dev/null \; | |
find $MAILROOT -name 'cur' -type d '!' -iregex ".*${DELETEDDIRS}.*" '!' -iregex ".*${SPAMDIRS}.*" -exec sa-learn --no-sync --ham {} >> /dev/null \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment