move data out of /etc and in to /var

This commit is contained in:
2020-01-15 10:49:40 -05:00
parent a52124e582
commit 3149ec2cea
2 changed files with 7 additions and 7 deletions

View File

@ -12,7 +12,7 @@ my @vh = $ddns->get('_vhosts');
# For each virtual host, generate a vhost zone file if there isn't one
my $changecount = 0;
foreach my $i (@vh) {
my $zf = "/etc/bind/vhost/db.$i->{zone}";
my $zf = "/var/lib/bind/bind/vhost/db.$i->{zone}";
unless ( -f $zf ) {
print "Generating new zone file for $i->{zone}\n";
open(my $fh, ">", $zf)
@ -22,8 +22,8 @@ foreach my $i (@vh) {
}
}
# For each vhost in /etc/bind/vhost, make sure it has an entry in the zone file.
foreach my $i (</etc/bind/vhost/*>) {
# For each vhost in /var/lib/bind/vhost, make sure it has an entry in the zone file.
foreach my $i (</var/lib/bind/vhost/*>) {
my ($zone) = ($i =~ /\/db.(.+)$/);
next unless ($zone);
unless (contains_zone($zone, @vh)) {
@ -37,11 +37,11 @@ if ($changecount) {
# If we made any changes, then generate the full vhost list
my ($fh, $path) = tempfile();
foreach my $i (sort {$a->{zone} cmp $b->{zone}} @vh) {
print $fh "zone \"$i->{zone}\" { type master; file \"/etc/bind/vhost/db.$i->{zone}\"; };\n";
print $fh "zone \"$i->{zone}\" { type master; file \"/var/lib/bind/vhost/db.$i->{zone}\"; };\n";
}
close $fh;
print "Installing new vhost list\n";
system("install -o bind -g bind $path /etc/bind/vhost.zones.9");
system("install -o bind -g bind $path /var/lib/bind/vhost.zones.9");
print "Reloading DNS files\n";
system("rndc reload");
}