Code is Love

What domains are awaiting mail from my server?

by someguy on Jun.10, 2008, under Uncategorized

Here’s a less than elegant solution to get a summary of the number of emails per domain that have mail sitting in your postfix queue.

#!/bin/sh
postqueue -p|egrep '^([[:space:]])+([[:alnum:]]|.|-|_)+@([[:alnum:]]|-)+.([[:alnum:]]+|.|-)*([[:alpha:]]){2,4}$’|awk ‘{ print $1 }’
|awk -F@ ‘{ print $2 }’|sort|uniq -i -c
| awk ‘BEGIN {sum=0} {sum += $1} {print $0} END {printf(”—————————n “sum” Total E-mails that are properly formattedn”)}’

Thank you, awk

:, , , ,

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...