????
Current Path : /scripts/ |
Current File : //scripts/dnstransfer |
#!/usr/local/cpanel/3rdparty/bin/perl # cpanel4 - scripts Copyright(c) 1997-2011 cPanel, Inc.. # All rights Reserved. # copyright@cpanel.net http://cpanel.net # This code is subject to the cpanel license. Unauthorized copying is prohibited print "Rebuilding DNS Zones List from master server .....\n"; my $dnsmaster; open( CONF, "/etc/wwwacct.conf" ) || die "/etc/wwwacct.conf not found\n"; while (<CONF>) { $_ =~ s/\n//g; if ( $_ !~ /^;/ ) { if ( $_ =~ /DNSMASTER/ ) { $dnsmaster = ( split / /, $_ )[1]; } } } close(CONF); if ( $dnsmaster eq "" || $dnsmaster eq "none" ) { print "Sorry no dns master was defined\n"; exit; } system("cp -f /etc/named.conf /etc/named.conf.pretransfer"); system("scp -o \"Protocol 1,2\" $dnsmaster:/etc/named.conf /etc/named.conf.dnstransfer"); my ( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks ) = stat("/etc/named.conf.dnstransfer"); if ( $size < 10 ) { print "Scp failed!\n"; exit; } open( RNC, ">/etc/named.conf" ); open( NC, "/etc/named.conf.pretransfer" ); while (<NC>) { if (/zone \"/) { last; } print RNC; } close(NC); open( NC, "/etc/named.conf.dnstransfer" ); my $inzones = 0; while (<NC>) { if (/zone \"/) { $inzones = 1; } if ($inzones) { print RNC; } } close(NC); close(RNC); system("/usr/local/cpanel/scripts/makesecondary"); print "Rebuild Complete\n";