Ignore:
Timestamp:
07/04/10 16:01:22 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix dangling $defcustid -> $IPDB::defcustid
Return quietly from mailNotify if there's no recipients
Move rWHOIS data path definition/default into MyIPDB.pm/IPDB.pm respectively

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/extras/db2rwhois.pl

    r417 r420  
    2626#$ENV{"PATH"} = "/bin;/usr/bin";
    2727
    28 my $rwhoisDataPath = "/etc/rwhoisd";
    29 
    3028my @autharea;
    3129my $authrw;
    3230# Use the template file to allow us to keep persistent nodes aside from netblock data
    33 open AUTHTEMPLATE, "<$rwhoisDataPath/rwhoisd.auth_template";
     31open AUTHTEMPLATE, "<$IPDB::rwhoisDataPath/rwhoisd.auth_template";
    3432my $template_persist;
    3533while (<AUTHTEMPLATE>) {
     
    4846
    4947# Get the list of live directories for potential deletion
    50 opendir RWHOISROOT, $rwhoisDataPath;
     48opendir RWHOISROOT, $IPDB::rwhoisDataPath;
    5149my %rwhoisdirs;
    5250foreach (readdir RWHOISROOT) {
     
    104102
    105103# Hokay.  Gonna do checks *here* to see if we need to create new master trees
    106   my $netdatadir = "$rwhoisDataPath/$rwnet";
     104  my $netdatadir = "$IPDB::rwhoisDataPath/$rwnet";
    107105  if (! -e $netdatadir) {
    108106    print " New master $masterblocks[$i]!\n";
     
    152150    print "  Copying template files...\n";
    153151##fixme: find a way to do this without a shell (or functional equivalent)
    154     qx { /bin/cp $rwhoisDataPath/skel/attribute_defs/* $netdatadir/attribute_defs/ };
     152    qx { /bin/cp $IPDB::rwhoisDataPath/skel/attribute_defs/* $netdatadir/attribute_defs/ };
    155153
    156154##fixme: not sure if this is even necessary, since it's not referenced anywhere I can recall...
     
    188186  my $masterfilename = "$rwnet/data/network/".$masterblocks[$i]->addr."-".$masterblocks[$i]->masklen.".txt";
    189187
    190   open MASTERFILE,">$rwhoisDataPath/$masterfilename";
     188  open MASTERFILE,">$IPDB::rwhoisDataPath/$masterfilename";
    191189
    192190  print MASTERFILE "ID: NETBLK-ISP.$masterblocks[$i]\n".
     
    310308foreach my $netdir (keys %rwhoisdirs) {
    311309  print "deleting obsolete directory $netdir...\n";
    312   rmtree ( "$rwhoisDataPath/$netdir", { verbose => 1, error => \my $errlist } );
     310  rmtree ( "$IPDB::rwhoisDataPath/$netdir", { verbose => 1, error => \my $errlist } );
    313311  for my $diag (@$errlist) {
    314312    my ($file, $message) = each %$diag;
     
    323321if ($authrw) {
    324322  print "Regenerating auth_area\n";
    325   open RWHOISDAUTH, ">$rwhoisDataPath/rwhoisd.auth_area";
     323  open RWHOISDAUTH, ">$IPDB::rwhoisDataPath/rwhoisd.auth_area";
    326324  print RWHOISDAUTH "# WARNING: This file is autogenerated!  Any static nodes should\n".
    327325                "# be entered in /etc/rwhoisd/rwhoisd.auth_template\n";
     
    339337
    340338  # restart/reload rwhoisd
    341   if (-e "$rwhoisDataPath/rwhoisd.pid") {       # no pidfile, no restart.
     339  if (-e "$IPDB::rwhoisDataPath/rwhoisd.pid") { # no pidfile, no restart.
    342340    print "Restarting rwhoisd\n";
    343     open PIDFILE, "<$rwhoisDataPath/rwhoisd.pid";
     341    open PIDFILE, "<$IPDB::rwhoisDataPath/rwhoisd.pid";
    344342    my ($rwpid) = (<PIDFILE> =~ /^(\d+)/);
    345343    close PIDFILE;
Note: See TracChangeset for help on using the changeset viewer.