Current time: 09-21-2024, 06:45 PM Hello There, Guest! (LoginRegister)


Post Reply 
[Shell] Größe der Postfächer ermitteln
Author Message
grisu Offline
Junior Member
*

Posts: 64
Joined: Jun 2009
Reputation: 0
Post: #8
RE: [Shell] Größe der Postfächer ermitteln
(04-23-2009 03:08 PM)Knut Wrote:  en: The disadvantage is the subsequent sorting! 120K is more then 33M. SadShy

Thank you Knut for this Script Smile
Based upon it I've got a tiny modification using awk instead of sed. Now it supports human readability (in megabytes) AND sorting which works for me.

Maybe some guys uf you may find this helpful...

Code:
#!/bin/bash

FOLDER="/var/mail/virtual/"

for domain in $(ls $FOLDER); do
        if [ `ls $FOLDER$domain -1a|wc -l` -gt 2 ]; then
                echo "Domain: $domain";
                echo "==================================";
                du -s $FOLDER$domain/*|sort -gr| awk '{printf("%.3f MB\t%-10s\n", ($1 / 1024), $2)}';
                echo "";
                echo "";
        fi
done

echo "Alle Domains:"
echo "============="
du -s $FOLDER*/*|sort -gr | awk '{printf("%.3f MB\t%-10s\n", ($1 / 1024), $2)}';
echo ""
echo ""

greetings and a nice Weekend
(This post was last modified: 08-07-2010 01:20 AM by grisu.)
08-07-2010 01:18 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [Shell] Größe der Postfächer ermitteln - grisu - 08-07-2010 01:18 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)