Line 358: |
Line 358: |
| If you want, the code below counts how many e-mail are in LearnAsSpam and LearnAsHam directories (of all users). It's useful to know if your users are using those folders. However Learn will send you a report after each pass. If you are interested on the number of emails lefts in the junkmail directory without any attention, you could install [[mailstats | smeserver-mailstats]] and activate the option to account for them | | If you want, the code below counts how many e-mail are in LearnAsSpam and LearnAsHam directories (of all users). It's useful to know if your users are using those folders. However Learn will send you a report after each pass. If you are interested on the number of emails lefts in the junkmail directory without any attention, you could install [[mailstats | smeserver-mailstats]] and activate the option to account for them |
| <pre> | | <pre> |
| + | #!/bin/bash |
| # ContaLearn.sh | | # ContaLearn.sh |
| + | |
| + | #for compatibility with older versions without rpm, testing |
| + | if [ `/sbin/e-smith/db configuration getprop LearnAsSpam dir` ]; then |
| + | LearnAsSpam=`/sbin/e-smith/db configuration getprop LearnAsHam dir`; |
| + | else |
| + | LearnAsSpam='LearnAsSpam'; |
| + | fi |
| + | |
| + | if [ `/sbin/e-smith/db configuration getprop LearnAsHam dir` ]; then |
| + | LearnAsHam=`/sbin/e-smith/db configuration getprop LearnAsHam dir`; |
| + | else |
| + | LearnAsHam='LearnAsSpam'; |
| + | fi |
| + | |
| + | JunkMail='junkmail'; |
| | | |
| echo | | echo |
Line 365: |
Line 381: |
| declare -i tspam | | declare -i tspam |
| declare -i tham | | declare -i tham |
| + | declare -i tleft |
| + | declare -i tnseen |
| | | |
| + | printf "%25s %10s %10s %10s %10s \n" "User" "LearnAsSpam" "LearnAsHam" "JunkMail" "NotSeen" |
| pushd /home/e-smith/files/users/ >>/dev/nul | | pushd /home/e-smith/files/users/ >>/dev/nul |
| for u in `ls | grep -v admin` | | for u in `ls | grep -v admin` |
| do | | do |
− | spam=`ls -1 $u/Maildir/.LearnAsSpam/cur |wc -l` | + | spam=`ls -1 $u/Maildir/.$LearnAsSpam/cur |wc -l` |
− | ham=`ls -1 $u/Maildir/.LearnAsHam/cur |wc -l` | + | ham=`ls -1 $u/Maildir/.$LearnAsHam/cur |wc -l` |
− | if [[ $spam > 0 ]] || [[ $ham > 0 ]]; then | + | left=`ls -1 $u/Maildir/.$JunkMail/cur |wc -l` |
− | echo "User: $u LearnAsSpam: $spam LearnAsHam: $ham" | + | nseen=`ls -1 $u/Maildir/.$JunkMail/new |wc -l` |
| + | if [[ $spam > 0 ]] || [[ $ham > 0 ]] || [[ $left > 0 ]] || [[ $nseen > 0 ]]; then |
| + | printf "%25s %10d %10d %10d %10d \n" $u $spam $ham $left $nseen |
| fi | | fi |
| tspam=$tspam+$spam | | tspam=$tspam+$spam |
| tham=$tham+$ham | | tham=$tham+$ham |
| + | tleft=$tleft+$left |
| + | tnseen=$tnseen+$nseen |
| done | | done |
− | echo "-----------------------------------------------------------------------------" | + | echo "----------------------------------------------------------------------" |
− | echo " Total: Spam: $tspam Ham: $tham "
| + | printf "%25s %10d %10d %10d %10d \n" "Total:" $tspam $tham $tleft $tnseen |
| popd >>/dev/nul | | popd >>/dev/nul |
| echo | | echo |
| + | |
| </pre> | | </pre> |
| | | |