[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] Script to Count Mailboxes in all Domains (raq2 + 3 tested)



Im not subscribed to the list because of the volume of mail and high level
of usage the list gets. . But it has saved my ass on numerous occasions...
so any comments can be CCed to dylan@xxxxxxxxxxxxxx

Heres a little bash script I hacked up to count the number of mailboxes in
each domain (on the bosses request of course)



#!/bin/bash
COUNT=1
while [ "$COUNT" -lt 169 ]
do       
echo "------------------"
ls -al /home/spool/mail/* | grep "site$COUNT " | wc | awk {'print $1 " Email
Account(s)."'}
ls -al /home/sites/ | awk {'print $9" "$10" "$11" "'} | grep www | grep
"site$COUNT "
COUNT=`expr $COUNT + 1`
done
exit 0 



You can direct the output to a file if you wish  eg  count.sh >
mailboxes.txt  
By no means an example of good scripting (in fact probably an illustration
of my laziness... although theres probably an easier way this worked nicely
for my purposes)  

Cheers, 

Dylan O'Donnell 
http://valley.fatuous.org 

DragNet Internet Services
510 Elizabeth St Albury NSW Australia 2640
Ph: 02 6021 4100, Fax: 02 6021 3144
www.dragnet.com.au

This email has been scanned by Dragnets CleanMail Service for more information about this services please refer to: 
www.dragnet.com.au/services/cleanmail.html

***************************************************************************
This email and any files transmitted with it are confidential, and are
intended solely for the use of the individual or entity to whom they are
addressed. If you are not the original recipient, any use, dissemination,
forwarding, printing, or copying of this email is strictly prohibited.
If you received this email in error, please notify the sender.

This message has been scanned for viruses by the Dragnet CleanMail Service.
***************************************************************************