From c72968f277c466a8f2b396199d2fb004a3c289c7 Mon Sep 17 00:00:00 2001 From: Jorj Bauer Date: Wed, 24 Feb 2016 09:47:16 -0500 Subject: [PATCH] added new is-managed for testing --- Makefile.PL | 1 + bin/is-managed | 21 +++++++++++++++++++++ bin/sync-master-vhosts | 12 ++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100755 bin/is-managed diff --git a/Makefile.PL b/Makefile.PL index bf9b8d7..9819a95 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -19,6 +19,7 @@ WriteMakefile( 'bin/list-custom', 'bin/sync-slave', 'bin/list-all', + 'bin/is-managed', ], 'AUTHOR' => 'Jorj Bauer ', ); diff --git a/bin/is-managed b/bin/is-managed new file mode 100755 index 0000000..bb5b206 --- /dev/null +++ b/bin/is-managed @@ -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"; diff --git a/bin/sync-master-vhosts b/bin/sync-master-vhosts index f5bbf6e..c0b46fe 100755 --- a/bin/sync-master-vhosts +++ b/bin/sync-master-vhosts @@ -63,7 +63,7 @@ sub create_zonefile { my $zone = $i->{zone} . "."; 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 <