Koozali.org: home of the SME Server
Obsolete Releases => SME 8.x Contribs => Topic started by: Drifting on December 10, 2014, 09:32:27 AM
-
Hi Chaps.
Anyone aware of a simple contrib that would indicate to the local admin or user how much email they are storing? Did a brief google on here but most of the info that came up related to version 7, and currently I run most 8.x
P
-
mmmhhh..
something like
du -s -m /home/e-smith/files/users/*/Maildir | sort -n -r
in cron?
7827 /home/e-smith/files/users/tania/Maildir
6183 /home/e-smith/files/users/roberto/Maildir
2910 /home/e-smith/files/users/gianni/Maildir
499 /home/e-smith/files/users/archivio/Maildir
2 /home/e-smith/files/users/assistenza/Maildir
1 /home/e-smith/files/users/spam/Maildir
1 /home/e-smith/files/users/riunioni/Maildir
1 /home/e-smith/files/users/notspam/Maildir
1 /home/e-smith/files/users/michele/Maildir
1 /home/e-smith/files/users/laura/Maildir
1 /home/e-smith/files/users/katia/Maildir
1 /home/e-smith/files/users/chiara/Maildir
-
Brilliant thank you so much, wished I understood more command line. Note duly made for later use.
Regards P
-
du(1) - Linux man page
Name
du - estimate file space usage
Synopsis
du [OPTION]... [FILE]...
du [OPTION]... --files0-from=F
Description
Summarize disk usage of each FILE, recursively for directories.
-s, --summarize
display only a total for each argument
-m
like --block-size=1M
and
sort(1) - Linux man page
Name
sort - sort lines of text files
Synopsis
sort [OPTION]... [FILE]...
sort [OPTION]... --files0-from=F
Description
Write sorted concatenation of all FILE(s) to standard output.
-n, --numeric-sort
compare according to string numerical value
-r, --reverse
reverse the result of comparisons
HTH
-
Or :
du -h -s /home/e-smith/files/users/*/Maildir | sort -n -r
If you want a human readable format :-)
(ha - quick edit to point out that this doesn't appear to sort correctly. Bug in DU with Gb ?)
Alternatively how about :
http://wiki.contribs.org/Durep
http://wiki.contribs.org/Diskusage (old - use with care)
Typical Stefano - only does half the job ;-)
B Rgds
John
-
I disagree with you..
if you use -h switch, you can have size in different measure unit:
[root@server ~]# du -h -s /home/e-smith/files/users/*/Maildir | sort -n -r
499M /home/e-smith/files/users/archivio/Maildir
84K /home/e-smith/files/users/michele/Maildir
68K /home/e-smith/files/users/chiara/Maildir
32K /home/e-smith/files/users/spam/Maildir
32K /home/e-smith/files/users/riunioni/Maildir
32K /home/e-smith/files/users/notspam/Maildir
32K /home/e-smith/files/users/laura/Maildir
32K /home/e-smith/files/users/katia/Maildir
7.7G /home/e-smith/files/users/tania/Maildir
6.1G /home/e-smith/files/users/roberto/Maildir
2.9G /home/e-smith/files/users/gianni/Maildir
1.2M /home/e-smith/files/users/assistenza/Maildir
as you can (easily, considering your age) see, you have no order.. :-P
-
Hence I did the quick edit to say :
"(ha - quick edit to point out that this doesn't appear to sort correctly. Bug in DU with Gb ?)"
Yes, my age excuses me from many things :-)
-
But this works (a bit of Googling Stefano :-P :-P :-P )
du -s /home/e-smith/files/users/*/Maildir | sort -rn | cut -f2- | xargs -d "\n" du -sh
5.7G /home/e-smith/files/users/joe/Maildir
853M /home/e-smith/files/users/brian/Maildir
455M /home/e-smith/files/users/mark/Maildir
195M /home/e-smith/files/users/fred/Maildir
70M /home/e-smith/files/users/nigel/Maildir
924K /home/e-smith/files/users/marion/Maildir
264K /home/e-smith/files/users/nellie/Maildir
136K /home/e-smith/files/users/josh/Maildir
32K /home/e-smith/files/users/sonia/Maildir
32K /home/e-smith/files/users/sam/Maildir
32K /home/e-smith/files/users/sarah/Maildir
32K /home/e-smith/files/users/judith/Maildir
32K /home/e-smith/files/users/emilia/Maildir
32K /home/e-smith/files/users/caroline/Maildir
Soy Ingles, pero no soy loco.....
:lol: :lol: :lol:
-
Hombre, I didn't search because I use that command often :-)
it simply works out of the box :-P
-
please install ncdu from epel, it is quite simple and a nice CLI
-
ReetP and Stefano - hey look mines BIGGER than yours :shock: :lol:
-
LOL!
-
ROTFL :-D