Chkdefaultaddresssize

From brokenpoet.org wiki

This script is used to check the size of and count of messages in all users default mail directories



wget http://scripts.brokenpoet.org/chkdefaultaddresssize.sh



#!/bin/bash

# written by bcathey 033108 12:18
 
for i in $(cat /etc/domainusers | cut -d ":" -f 1|sort)

do
  if [ -d /home/$i/mail/new ];
    then
    a=$(du -hs /home/$i/mail/new|awk '{print $1}';)
    b=$(du -hs /home/$i/mail/cur|awk '{print $1}';)
    c=$(find /home/$i/mail/new -type f|wc -l)
    d=$(find /home/$i/mail/cur -type f|wc -l)
    if [ $a != "4.0K" ];
      then
      echo ""
      echo -e "Checking Default Mailbox Size for \E[34m\033[1m$i . . .\033[0m"  
        if [ $a != "4.0K" ];
          then
          echo "/home/$i/mail/new is $a and contains $c files"
        fi
        if [ $b != "4.0K" ];
          then
          echo "/home/$i/mail/cur is $b and contains $d files"
        fi
    elif [ $b != "4.0K" ]
      then
      echo ""
      echo -e "Checking Default Mailbox Size for \E[34m\033[1m$i . . .\033[0m"  
        if [ $a != "4.0K" ];
          then
          echo "/home/$i/mail/new is $a and contains $c files"
        fi
        if [ $b != "4.0K" ];
          then
          echo "/home/$i/mail/cur is $b and contains $d files"
        fi
    fi
  fi
done
Personal tools