One of my customer recently approached me and told me to give a detailed list of all of his mail accounts and mail usage. The script I used for this purpose is given below.
Script to list all Mailboxes and disk usage in Plesk
if [ -d /var/qmail/mailnames ]; then echo -ne "\n\n=== MAILBOXES ===\n"; cd /var/qmail/mailnames && TMB=$(du -ks */* 2>/dev/null | sort -nr | cut -f2); if [ -n "$TMB" ]; then echo "$TMB" | xargs du -sh; fi; echo "[`find . -mindepth 2 -maxdepth 2 -type d | wc -l` Mailboxes - Total `du -hs | cut -f1`]"; fi;
=== MAILBOXES ===
140K example.com/mhtest
116K example.com/test
112K example212.com/gary
112K 123example.com/drotis
76K example456.com/jim
76K example546.com/admin
[6 Mailboxes - Total 676K]
Script to list disk usage of all domains in Plesk
if [ -d /var/www/vhosts ]; then echo -ne "\n\n=== WEBSITES ===\n"; cd /var/www/vhosts && du -ks --exclude='chroot' --exclude='default' * | sort -nr | cut -f2 | xargs du -sh; echo "[`ls --ignore='chroot' --ignore='default' | wc -l` Sites - Total `du -hs . | cut -f1`]"; fi;
Thank you,