[Shell] Größe der Postfächer ermitteln - Printable Version +- ispCP - Board - Support (http://www.isp-control.net/forum) +-- Forum: ispCP Omega Contributions Area (/forum-40.html) +--- Forum: Snippets (/forum-42.html) +--- Thread: [Shell] Größe der Postfächer ermitteln (/thread-6499.html) |
[Shell] Größe der Postfächer ermitteln - Knut - 04-23-2009 04:38 AM Neben der Größe meiner gehosteten Sites interessiert mich auch monatlich die Postfachgröße. Dafür habe ich folgendes Shellscript: Code: pico /root/bin/mailfoldersize Code: #!/bin/bash Ausführbar machen: Code: chmod +x /root/bin/mailfoldersize und für die monatliche Zustellung die Crontab bearbeiten: Code: crontab -e Code: 0 0 1 * * /root/bin/mailfoldersize | mail -s "[SERVERNAME] Postfach-Stats" "mailadresse@domain.tld" >/dev/null 2>&1 Knut RE: [Shell] Größe der Postfächer ermitteln - DiXeoN - 04-23-2009 04:45 AM 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 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 RE: [Shell] Größe der Postfächer ermitteln - TheCry - 04-23-2009 05:59 AM Hallo Knut, Nutze doch zusätzlich noch die Option -h bei "du" Quote:-h, --human-readable Sieht dementsprechend besser aus.. Ansonsten ist das und das andere Skript echt gut! Gruß Sascha Edit: english translation. if you use "du -s -h" it will show you a better output of the dirsize. RE: [Shell] Größe der Postfächer ermitteln - joximu - 04-23-2009 06:52 AM in short: "du -hs" but the problem is the sorting afterwards... /J RE: [Shell] Größe der Postfächer ermitteln - Knut - 04-23-2009 03:08 PM Der Nachteil ist dabei die anschließende Sortierung ! 120K kommt dann vor 33M als Beispiel. en: The disadvantage is the subsequent sorting! 120K is more then 33M. @ joximu : ups your are faster RE: [Shell] Größe der Postfächer ermitteln - enrico73 - 03-24-2010 08:55 AM Bekommen leider nur eine leere Email. Hab grad das Script installiert und es kam auch eine Mail vom Cron. Kann mir einer sagen warum die mail leer ist? Muss das Script in /root/bin sein oder geht es auch in root? Gruß Rico PS: erledigt!!! RE: [Shell] Größe der Postfächer ermitteln - gOOvER - 03-24-2010 09:19 AM Please ONLY english here RE: [Shell] Größe der Postfächer ermitteln - grisu - 08-07-2010 01:18 AM (04-23-2009 03:08 PM)Knut Wrote: en: The disadvantage is the subsequent sorting! 120K is more then 33M. Thank you Knut for this Script 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 greetings and a nice Weekend RE: [Shell] Größe der Postfächer ermitteln - mr.x - 08-29-2010 08:53 PM Hi grisu, (08-07-2010 01:18 AM)grisu Wrote: Maybe some guys uf you may find this helpful... Thanks for your modification ! /Mr.X |