Usage Report Plus 'Catch-All' Stats
From brokenpoet.org wiki
This is a 'more complete' report which takes into account the 'Catch-All' mail. I mainly use this report to see how many of the files in a users account are from the 'Catch-All' Mail.
It will look like this:
User Count Size | From Catch-All : new : cur
-------------------------------------------------------------
aguyhere 320 14M | 0 : 4.0K : 4.0K
begone 147 1.1M | 33 : 164K : 4.0K
comeone 36 312K | 0 : 4.0K : 4.0K
crannie 54 456K | 0 : 4.0K : 4.0K
dynaho 6 120K | 0 : 4.0K : 4.0K
extorta1 250 4.5M | 23 : 96K : 4.0K
flipoy 1313 22M | 0 : 4.0K : 4.0K
fourth 667 7.1M | 0 : 4.0K : 4.0K
gremlins 435 71M | 0 : 4.0K : 4.0K
grandma 495 109M | 0 : 4.0K : 4.0K
macdingl 6 108K | 0 : 4.0K : 4.0K
misterme 69 580K | 0 : 4.0K : 4.0K
scrapps 1298 40M | 0 : 4.0K : 4.0K
scooter 9525 100M | 0 : 4.0K :
trangle 528 9.9M | 0 : 4.0K : 4.0K
untu 944 15M | 0 : 4.0K : 4.0K
-------------------------------------------------------------
16093 56
As you can see, this summarizes the counts as well. I will be working on this further and should *really* make it a downloadable script I guess.
Anyway - here it is:
printf "User Count Size | From Catch-All : new : cur\n";\
echo "-------------------------------------------------------------";\
tot_count=0;tot_mcount=0;for user in $(cat /etc/domainusers |cut -d':' -f1|sort);\
do count=$(find /home/$user -type f|wc -l);size=$(du -hs /home/$user|awk '{print $1}');\
if [ -a /home/$user/mail/new ]; then cmcount=$(find /home/$user/mail/cur -type f|wc -l);\
nmcount=$(find /home/$user/mail/new -type f|wc -l);mcount=$(($cmcount + $nmcount));\
nsize=$(du -hs /home/$user/mail/new|awk '{print $1}');csize=$(du -hs /home/$user/mail/cur|awk '{print $1}');\
else mcount="";cmcount="";nmcount="";nsize="";csize="";fi;tot_count=$(($count+$tot_count));\
tot_mcount=$(($mcount+$tot_mcount));printf "%-9s%10s%9s | %14s : %5s : %5s\n" $user $count $size $mcount $nsize $csize;\
done;echo "-------------------------------------------------------------";printf "%19s%26s\n" $tot_count $tot_mcount
