#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; use File::Basename; my %already; my $i = 0; while (my $in = ) { if ($in =~ /^(_acme-challenge).(\S+).*/) { my ($record, $domain) = ($1, $2); if ((my $blank = ) =~ /\S/) { die "missing blank after $record line"; } chomp(my $token = ); print "$record -- $domain -- $token\n"; if (!$already{$domain}++) { `cp $domain $domain.old`; `<$domain.old grep -v $record >$domain`; } `echo $record IN TXT '\"$token\"' >>$domain`; last if ++$i == 4; } } for my $domain (sort keys %already) { `v scp $domain ucm.dev:/etc/bind/freens/`; } `v sudo service bind9 reload & v ssh ucm.dev sudo service bind9 reload & wait`;