Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Script to list and disk usage in Plesk - Mailboxes & all domains  (Read 3152 times)

0 Members and 1 Guest are viewing this topic.

sajugovind

  • Guest
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

Code: [Select]
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;
Code: [Select]
=== 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

Code: [Select]
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,