added new is-managed for testing

This commit is contained in:
2016-02-24 09:47:16 -05:00
parent 80061a8829
commit c72968f277
3 changed files with 28 additions and 6 deletions

View File

@ -19,6 +19,7 @@ WriteMakefile(
'bin/list-custom', 'bin/list-custom',
'bin/sync-slave', 'bin/sync-slave',
'bin/list-all', 'bin/list-all',
'bin/is-managed',
], ],
'AUTHOR' => 'Jorj Bauer <jorj@jorj.org>', 'AUTHOR' => 'Jorj Bauer <jorj@jorj.org>',
); );

21
bin/is-managed Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/perl
use strict;
use warnings;
use Martnet::DDNS;
my $dom = shift || die;
$dom =~ s/^(.+)\.$/$1/; # remove trailing dot
my $ddns = Martnet::DDNS->new();
my @vh = $ddns->get();
foreach my $i (@vh) {
if (lc($i->{zone}) eq $dom) {
print "Yes, $i->{zone} is managed [$i->{type}]\n";
exit 0;
}
}
print "No, $dom does not appear to be managed\n";

View File

@ -63,7 +63,7 @@ sub create_zonefile {
my $zone = $i->{zone} . "."; my $zone = $i->{zone} . ".";
my @now = localtime(); my @now = localtime();
my $serial = sprintf("%.4d%.2d%.2d00", $now[5]+1900, $now[4]+1, $now[3]); my $serial = sprintf("%.4d%.2d%.2d01", $now[5]+1900, $now[4]+1, $now[3]);
print $fh <<EOF print $fh <<EOF
; ;
@ -82,11 +82,11 @@ $zone IN SOA ns.martnet.com. root.ns.martnet.com. (
43200 ) ; Negative Cache TTL 12 hours 43200 ) ; Negative Cache TTL 12 hours
; define name servers ; define name servers
$zone IN NS ns.martnet.com $zone IN NS ns.martnet.com.
$zone IN NS ns1.martnet.com $zone IN NS ns1.martnet.com.
$zone IN NS ns2.martnet.com $zone IN NS ns2.martnet.com.
$zone IN NS ns3.martnet.com $zone IN NS ns3.martnet.com.
$zone IN NS ns4.martnet.com $zone IN NS ns4.martnet.com.
; define localhost ; define localhost
localhost IN A 127.0.0.1 localhost IN A 127.0.0.1