#!/usr/bin/perl -w # # qdomto # John Simpson 2003-04-09 # # scan /var/qmail/queue/remote/*/* and count how many messages are waiting # to be delivered to each domain name # # 2005-04-11 jms1 - (no code changed.) changed the copyright notice to # specify that the license is the GPL VERSION 2 ONLY. i'm not comfortable # with the "or future versions" clause until i know what these "future # versions" will look like. # ############################################################################### # # Copyright (C) 2003-2005 John Simpson. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # or visit http://www.gnu.org/licenses/gpl.txt # ############################################################################### require 5.003 ; use strict ; my $vqdir = "/var/qmail" ; my %dcount = () ; for my $f ( glob "$vqdir/queue/remote/*/*" ) { open ( I , "<$f" ) or next ; my $line = ; close I ; for my $addr ( split ( /\0/ , $line ) ) { if ( $addr =~ /\@(.*)/ ) { $dcount{"\L$1"} ++ ; } } } map { printf "%d\t%s\n" , $dcount{$_} , $_ } sort keys %dcount ;