Created
January 4, 2016 15:21
-
-
Save barnslig/2ea4f92bf18a4069b72e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
if test -d $HOME/Maildir/.Spam -a -d $HOME/Maildir/.Spam.New -a -d $HOME/Maildir/.Spam.Ham; then | |
# process new spam | |
find $HOME/Maildir/.Spam.New/cur $HOME/Maildir/.Spam.New/new -type f -print0 | while read -d $'\0' file; do | |
sudo dspam --user $USER --class=spam --source=error < $file | |
mv "$file" $HOME/Maildir/.Spam/cur/ | |
done | |
# process new ham | |
find $HOME/Maildir/.Spam.Ham/cur $HOME/Maildir/.Spam.Ham/new -type f -print0 | while read -d $'\0' file; do | |
sudo dspam --user $USER --class=innocent --source=error < $file | |
mv "$file" $HOME/Maildir/cur/ | |
done | |
# cleanup dspam database | |
# sudo dspam_clean -s -p -u # Does only work in database environments but not with the hash driver | |
sudo find /var/lib/dspam/data -name *.sig -type f -mtime +14 -delete | |
sudo find /var/lib/dspam/data -name *.css -not -path '*/\.*' -type f -exec cssclean {} \; # hidden files are owned by dspam and cannot be processed | |
else | |
echo "Get your Maildir in place" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment