Skip to content

Instantly share code, notes, and snippets.

@flat235
Last active April 26, 2020 19:53
Show Gist options
  • Select an option

  • Save flat235/4253d360feb5861ad7ed8db21a277701 to your computer and use it in GitHub Desktop.

Select an option

Save flat235/4253d360feb5861ad7ed8db21a277701 to your computer and use it in GitHub Desktop.

Revisions

  1. flat235 revised this gist Feb 10, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions spamassassin-update.sh
    Original file line number Diff line number Diff line change
    @@ -10,5 +10,5 @@ sa-update --allowplugins
    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 {} \;
    find $MAILROOT -name 'cur' -type d '!' -iregex ".*${DELETEDDIRS}.*" '!' -iregex ".*${SPAMDIRS}.*" -exec sa-learn --no-sync --ham {} \;
    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 \;
  2. flat235 revised this gist Feb 7, 2017. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions spamassassin-update.sh
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,14 @@
    #!/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
    # 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 '.*deleted-maildirs.*' -iregex '.*spam.*' -exec sa-learn --no-sync --spam {} \;
    find $MAILROOT -name 'cur' -type d '!' -iregex '.*deleted-maildirs.*' '!' -iregex '.*spam.*' -exec sa-learn --no-sync --ham {} \;
    find $MAILROOT -name 'cur' -type d '!' -iregex ".*${DELETEDDIRS}.*" -iregex ".*${SPAMDIRS}.*" -exec sa-learn --no-sync --spam {} \;
    find $MAILROOT -name 'cur' -type d '!' -iregex ".*${DELETEDDIRS}.*" '!' -iregex ".*${SPAMDIRS}.*" -exec sa-learn --no-sync --ham {} \;
  3. flat235 created this gist Feb 7, 2017.
    12 changes: 12 additions & 0 deletions spamassassin-update.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash
    # where are the maildirs?
    MAILROOT=/var/vmail/

    # 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
    # exclude deleted maildirs
    find $MAILROOT -name 'cur' -type d '!' -iregex '.*deleted-maildirs.*' -iregex '.*spam.*' -exec sa-learn --no-sync --spam {} \;
    find $MAILROOT -name 'cur' -type d '!' -iregex '.*deleted-maildirs.*' '!' -iregex '.*spam.*' -exec sa-learn --no-sync --ham {} \;