Current time: 12-23-2024, 03:47 AM Hello There, Guest! (LoginRegister)


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

Posts: 284
Joined: Feb 2008
Reputation: 2
Post: #2
RE: [Shell] Größe der Postfächer ermitteln
English translation:

Besides the size of my hosted sites, I'm also interested in the monthly mailbox size. I have the following shell script:

Code:
pico /root/bin/mailfoldersize
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/*|sed "s#$FOLDER$domain/##g"|sort -gr;
                echo "";
                echo "";
        fi
done

echo "All Domains:"
echo "============="
du -s $FOLDER*/*|sed "s#$FOLDER##g"|sort -gr;
echo ""
echo ""
Make it executable:
Code:
chmod +x /root/bin/mailfoldersize

For the monthly crontab:
Code:
crontab -e
Code:
0       0       1 * * /root/bin/mailfoldersize | mail -s "[SERVERNAME] Mailbox Stats" "your@mailadress.here" >/dev/null 2>&1
<- All in a single row!
04-23-2009 04:45 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 - DiXeoN - 04-23-2009 04:45 AM

Forum Jump:


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