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

Re: [cpx] Test for catchalls (before installing CPX)



On Sun, Feb 13, 2005 at 01:55:36PM -0600, Steve Yates wrote:
> 	I wrote a little script that will test all domains in local-host-names and the account hostname to ensure catchalls are present for all of them, and thought I would share it with the list for use before you install CPX.  It's in PHP, which is probably going to drive the Perl folks nuts :)

Nuts indeed; I've been called a nut now twice in the last week. I'm
beginning to wonder...

Here's a Perl version (only moderately tested):

  <catchall.pl>
  #!perl -w
  use strict;

  ## get virtusertable entries
  my %vut = ();
  open VUT, "/etc/mail/virtusertable";
  while( <VUT> ) { next unless /^\@(\S+)/; $vut{$1}++ }
  close VUT;

  ## check each local-host-name entry
  open LHN, "/etc/mail/local-host-names";
  while( <LHN> ) { next unless /^[a-zA-Z0-9-]/; chomp; print "$_\n" unless $vut{$_} }
  close LHN;
  </catchall.pl>

This prints a list of hostnames found in local-host-names, but no
corresponding catchall found in virtusertable. Usage:

  ./catchall.pl

Scott
-- 
Scott Wiersdorf
scottw@xxxxxxxxxxxx
======================================================================
This is <cpx@xxxxxxxxxxxxx>      <http://www.groupmail.org/lists/cpx/>
Before posting a question, please search the archives (see above URL).


Home | Main Index | Thread Index
Match: Format: Sort by:
Search: