diff options
-rw-r--r-- | dns_wizard/Bind.pm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/dns_wizard/Bind.pm b/dns_wizard/Bind.pm index b77e9887..65c178fc 100644 --- a/dns_wizard/Bind.pm +++ b/dns_wizard/Bind.pm @@ -35,7 +35,7 @@ use MDK::Wizard::Wizcommon; my $wiz = new MDK::Wizard::Wizcommon; -my $SERIAL = `date +%d%m20%y`; +my $SERIAL = chomp_(`date +%d%m20%y`); my $HOSTNAME = $wiz->{net}->network_get("HOSTNAME"); my $interface = 'eth0'; my $IPSERVER = $wiz->{net}->itf_get("IPADDR"); @@ -317,6 +317,21 @@ sub get_spe_ip { } } +sub increment_serial { + my ($iprev) = @_; + my ($SERIAL) = cat_("$ZONE_DIR/db.$DOMAINNAME.hosts") =~ m/\s+(.*?)\s+;\s+Serial/; + $SERIAL = chomp_($SERIAL+1); + print "$SERIAL\n"; + substInFile { + s/\s+\d+\s+;\s+Serial/ $SERIAL ; Serial/; + } "$ZONE_DIR/db.$DOMAINNAME.hosts"; + + substInFile { + s/\s+\d+\s+;\s+Serial/ $SERIAL ; Serial/; + } "$ZONE_DIR/db.$iprev.hosts"; +} + + sub crea_db_local { output($WDIR . "/db.localhost", <<EOF); \$TTL 3D @@ -470,7 +485,7 @@ sub crea_iprev { output($WDIR . "/db." . $iprev . ".hosts", <<EOF); \$TTL 3D @ IN SOA $SHORTHOSTNAME.$d. $SHORTHOSTNAME.$d. ( - $SERIAL ; serial + $SERIAL ; Serial 10800 ; Refresh 3600 ; Retry 604800 ; Expire @@ -745,6 +760,7 @@ sub do_it_add { append_to_file("$ZONE_DIR/db.$iprev.hosts", "$ipend\tIN\tPTR\t$SNAME.$DOMAINNAME.\n"); } + increment_serial($iprev); system("service named reload"); } |