Domain Email Usage question.

General Discussion of atomic repo and development projects.

Ask for help here with anything else not covered by other forums.
Galactic Zero
Forum Regular
Forum Regular
Posts: 471
Joined: Mon Dec 06, 2004 10:43 pm

Domain Email Usage question.

Unread post by Galactic Zero »

Does anyone have a script or cmd line search that will tell me how much mail is in each email (space used) account in a domain?

Thanks.
Franklyn Halamka
Still learning my way around Linux Security.
http://www.galacticzero.net
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

Re: Domain Email Usage question.

Unread post by faris »

du -h /var/qmail/mailnames

Ok, so that's quick and dirty, but it will show you what you need to know

Or how about this (very quick and dirty based on the above)

Code: Select all

path=/var/qmail/mailnames
for domain in $(dir $path); do
echo domain=$domain:
 for mailname in $(dir $path/$domain); do
 if [ -d $path/$domain/$mailname ]
 then
  du -hs $path/$domain/$mailname
 fi
done
done
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
Galactic Zero
Forum Regular
Forum Regular
Posts: 471
Joined: Mon Dec 06, 2004 10:43 pm

Re: Domain Email Usage question.

Unread post by Galactic Zero »

Thanks, script gave me what I needed.
Franklyn Halamka
Still learning my way around Linux Security.
http://www.galacticzero.net
breun
Long Time Forum Regular
Long Time Forum Regular
Posts: 2813
Joined: Sat Aug 20, 2005 9:30 am
Location: The Netherlands

Re: Domain Email Usage question.

Unread post by breun »

'du -sh' works fine generally, but when I'm looking for large files/folders and I don't know where they are exactly I tend to use ncdu (NCurses Disk Usage), which makes browsing a filesystem and finding large files/folders very easy without needing to run du -sh on every folder you want to examine. Check it out if you didn't know this text-based application yet!
Lemonbit Internet Dedicated Server Management
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

Re: Domain Email Usage question.

Unread post by faris »

A brilliant tip as usual - Thanks breun :-)

Faris.
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>
kellyj994
New Forum User
New Forum User
Posts: 1
Joined: Mon Dec 20, 2010 10:47 pm

Re: Domain Email Usage question.

Unread post by kellyj994 »

faris wrote:du -h /var/qmail/mailnames

Ok, so that's quick and dirty, but it will show you what you need to know

Or how about this (very quick and dirty based on the above)

Code: Select all

path=/var/qmail/mailnames
for domain in $(dir $path); do
echo domain=$domain:
 for mailname in $(dir $path/$domain); do
 if [ -d $path/$domain/$mailname ]
 then
  du -hs $path/$domain/$mailname
 fi
done
done

Thanks you for the post.


_________________
Watch movies online free
Post Reply